Here is my Complete code. There is no other code in the entire page.

Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="abcd@example.com"
myMail.To="abc@example.com"
myMail.TextBody="This is a message. "
Response.write "Execution Reached Before Send!"
myMail.Send
Response.write "Execution Reached After Send!"
set myMail=nothing

When I run this asp page, the result I am getting is "Execution Reached Before Send!". There is no other error messages. All I can understand from this is anything after the myMail.Send is not being executed and I am not receiving any emails also.

I am using Windows Server 2008 R2 Standard (Service Pack 1). SMTP mail server is installed on the local machine. I created a test email and dropped in "C:\inetpub\mailroot\Pickup" folder and it worked perfectly.

有帮助吗?

解决方案

The code worked after I added these four lines before the send.

myMail.Configuration.Fields.Item ("schemas.microsoft.com/cdo/configuration/sendusing") = 2
myMail.Configuration.Fields.Item ("schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost" 
myMail.Configuration.Fields.Item ("schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
myMail.Configuration.Fields.Update 
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top