|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
VBScript - Email - CDO mail
Hi I am using the following code for sending a mail from asp page.I am not sure how to track whether the email is sent or delivered.Even i give a wrong to address like 'ono@on.com'
I am getting err.number is 0.Can somebody explain me to track it.In which case the err.number hold the value. Set myMail=CreateObject("CDO.Message") on error resume next myMail.Subject="Sending email with CDO" myMail.From="mymail@mydomain.com" myMail.To="someone@somedomain.com" myMail.HTMLBody = "<h1>This is a message.</h1>" myMail.Send if err.number <> 0 then response.write "Error number " & err.number & " Error Desc " & err.description err.clear end if |
|
#2
|
|||
|
|||
|
try out below code :
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <% Dim strMessage strMessage = Request.Form("fieldname1") & request.Form("fielname2") theSchema="http://schemas.microsoft.com/cdo/configuration/" Set cdoConfig=server.CreateObject("CDO.Configuration") cdoConfig.Fields.Item(theSchema & "sendusing")= 2 cdoConfig.Fields.Item(theSchema & "smtpserver")="your smtp address" cdoConfig.Fields.Update Set cdoMessage=Server.CreateObject("CDO.Message") cdoMessage.Configuration=cdoConfig cdoMessage.From=Request.Form("sender's mail") cdoMessage.To="receiver's mail address" cdoMessage.Subject= Request.Form("subject") cdoMessage.TextBody= strMessage cdoMessage.Send Response.Redirect("http://www.yoursite.com") Set cdoMessage=Nothing Set cdoConfig=Nothing %> </body> </html> |
|
#3
|
|||
|
|||
|
Error message
If i had given some invalid email address in the to list, it should throe some error.
I tried giving some invalid address but its not throwing errors. |
|
#4
|
||||
|
||||
|
Simply put, the function CAN'T determine whether or not an email is successfully delivered because that delivery is handled by another mail server.
Google for Delivery Status Notification. The CDO object supports it.
__________________
Scripting problems? Windows questions? Ask the Windows Guru! Stay up to date with all of my latest content. Follow me on Twitter! Help us help you! Post your exact error message with these easy tips! |
|
#5
|
|||
|
|||
|
Replace fieldname1, fielname2, your smtp address, sender's mail, receiver's mail address, subject,http://www.yoursite.com with your values.
Hope it helps you out |
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > VBScript - Email - CDO mail |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|