Trouble in sending emails using CDO

A

aroraamit81

Hi,

I am using CDO component to send emails through my ASP page as I am
having IIS on windows XP..........
Now the mails goes and gets into mailroot\Queue folder but does not
reaches to the destination........
Pls tell me what do I need to do.........

here goes my code for your reference.....

Const cdoSendUsingPickup = 1
Const cdoSendUsingPort = 2
Const cdoSendUsingExchange = 3

Const cdoAnonymous = 0
Const cdoBasic = 1
Const cdoNTLM = 2

'Sends an email To aTo email address, with Subject And TextBody.
'The email is In text format.
'Lets you specify BCC adresses, Attachments, smtp server And Sender
email address
Function SendMailByCDO(aTo, Subject, TextBody, smtp, aFrom )
on error resume Next

Dim Message 'As New CDO.Message '(New - For VBA)

'Create CDO message object
Set Message = CreateObject("CDO.Message")

'Set configuration fields.
With Message.Configuration.Fields 'Original sender email address

..Item("http://schemas.microsoft.com/cdo/configuration/sendemailaddress")
= aFrom

' SMTP settings - without authentication, using standard port 25 on
host smtp
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing ")
= cdoSendUsingPort

..Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
= 25
.Item(" http://schemas.microsoft.com/cdo/configuration/smtpserver")
= smtp

'SMTP Authentication

..Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate
") = cdoAnonymous

.Update
End With

'Set other message fields.
With Message
'From, To, Subject And Body are required.
.From = aFrom
.To = aTo
.Subject = Subject

'Set TextBody property If you want To send the email As plain text
.HTMLBody = TextBody

'Set HTMLBody property If you want To send the email As an HTML
formatted
'.HTMLBody = TextBody

'Blind copy And attachments are optional.
If Len(BCC)>0 Then .BCC = BCC
If Len(Files)>0 Then .AddAttachment Files

'Send the email
.Send
End With

'Returns zero If succesfull. Error code otherwise
SendMailByCDO = Err.Number
End Function

Function SendMail()
Const smtp = "20.139.68.2"
Const aFrom = "(e-mail address removed)"
aTo="(e-mail address removed)"
Subject="Foo"
TextBody="fsdfsdfsd"

call SendMailByCDO(aTo, Subject, TextBody, smtp, aFrom )
End Function

call SendMail()

Regards,
Amit Arora
 
A

aroraamit81

Well Buddy,
This link jumped me to problem shotting for Windows 2000, though I
tested it on my windows XP server and found the same result i.e getting
into Queue folder....

Thanks
Amit Arora
 
J

Jeff Cochran

Well Buddy,
This link jumped me to problem shotting for Windows 2000, though I
tested it on my windows XP server and found the same result i.e getting
into Queue folder....

So, did you fix the problem? Did you look at the logs? Does anything
get delivered? Is your DNS correct? Have you tested the SMTP
manually? Checked the firewall?

Jeff
 
W

wolfing1

Jeff said:
So, did you fix the problem? Did you look at the logs? Does anything
get delivered? Is your DNS correct? Have you tested the SMTP
manually? Checked the firewall?

Jeff
I dunno but you're using 'anonymous' authentication (i.e. no
authentication), maybe the server is not processing them because of
that? Change it to basic and supply a username/password to
authenticate (a valid username/password defined in the email server),
which also should be the same one in the 'from' field to reduce
potential problems (like relaying forbidden and stuff)
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top