View Single Post
  #1 (permalink)  
Old November 22nd, 2010, 07:46 AM
il_betto il_betto is offline
Authorized User
 
Join Date: Sep 2009
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
Default CDO.Message and Outlook

Hi to All,

I have this kind of problem.
I have a page index.asp, in which there is a button that onclick recalls another page called mail.aspThis is the content of mail.asp:

<%@ Language=VBScript %>
<%
Option Explicit
Dim mail, sender
sender = Request.Form("user")
'
Set mail=CreateObject("CDO.Message")
mail.To="[email protected]"
mail.From="[email protected]"
mail.Subject="The Ticket has been SUBMITTED !"
mail.HTMLBody="<b>Proj: &nbsp;</b>" & Request.Form("proj") & "<br>" &_
"<b>Product: &nbsp;</b>" & Request.Form("pro") & "<br>" &_
"<b>User: &nbsp;</b>" & Request.Form("user") & "<br><br>" &_
.........
"<b>Notes: &nbsp;</b>" & Request.Form("notes_2") & "<br><br>"
mail.Send
Set mail=nothing
%>

This code is perfect but:

using CDO.Message we have no certainty that the receiver receives well the email,
there is no way to alert if the email, for some reasons (maybe related to some problem of internal server) don' t arrive at destination.
In fact we used this way of sending email and sometimes emails will not arrive, and we don' t know why.


So I ask if it is possible that when the user fills the fields in the form of index.asp, and push the button that recalls mail.asp,
can send email using CDO.Message but via Microsoft Outlook, that is the official intranet application for the emails.
In this case the user is sure that the different fields are good and, clicking send, can submit the email to the receiver.

I know that ASP is in server side and Outlook is member of client side ...

I have found in internet this useful link:

http://www.motobit.com/tips/detpg_send-email-from-asp/

that tells that is possible to send email using CDO.Message and Outlook.

I have tried to create a page mail.asp in this way but happens nothing:

<%@ Language=VBScript %>
<%
Option Explicit
Dim Outlook
Set Outlook = CreateObject("Outlook.Application")
'
Dim Message, aFrom, aTo
aFrom = "[email protected]"
aTo = "[email protected]"
Set Message = Outlook.CreateItem(olMailItem)
With Message
.Subject = "Ciao"
.Body = "Test"
.Recipients.Add (aTo)
Const olOriginator = 0
If Len(aFrom) > 0 Then .Recipients.Add(aFrom).Type = olOriginator
.Send
'
End With
%>

Thanks in advance !!!
Reply With Quote