CDO doesn't send email

S

Salim Afþar

Hi,
I'm using CDO object to send email but it doesn't send any email and it does
not give an error.
My code look like this:

Dim iMsg2
Dim iConf2
Dim Flds2
Const cdoSendUsingPort = 2
set iMsg2 = CreateObject("CDO.Message")
set iConf2 = CreateObject("CDO.Configuration")
Set Flds2 = iConf.Fields
' Set the CDOSYS configuration fields to use port 25 on the SMTP server.
With Flds2
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") =
cdoSendUsingPort
'ToDo: Enter name or IP address of remote SMTP server.
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"My_SMTP_Server"

..Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
) = 10
.Update
End With
' Apply the settings to the message.
With iMsg2
Set .Configuration = iConf
.To = "<[email protected]>" 'ToDo: Enter a valid email address.
.From = "(e-mail address removed)" 'ToDo: Enter a valid email address.
.Subject = "This is a test CDOSYS message (Sent via Port 25)"
.HTMLBody = "Test"
.Send
End With
' Clean up variables.
Set iMsg2 = Nothing
Set iConf2 = Nothing
Set Flds2 = Nothing

I have checked that a new file called "NTFS_f3a93f2401c34ab30000013f.EML" is
created in the folder "C:\Inetpub\mailroot\Queue\"

Also if I try to use CDO 1.x version I get an error.The code look like this:

Dim objNewMail

Set objNewMail = Server.CreateObject("CDONTS.NewMail")

objNewMail.From = "(e-mail address removed)"
objNewMail.To = "(e-mail address removed)"

objNewMail.Subject = "Test Subject"
objNewMail.Body = "Test Body"
objNewMail.Send

Set objNewMail = Nothing

Response.Write "Email has been sent"

I think the problem arises from SMTP Server.How can I understand that my
SMTP Server works fine?

Thanks,
Salim
 
R

Ray at

Have you looked in the event log to see if your server is unable to resolved
the recipient's domain?

Is the SMTP service running, or have you restarted it?

Ray at work
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top