Solved

CDO , not  mail sending !

Posted on 2008-10-06
6
686 Views
Last Modified: 2013-11-30
Hello,

I am trying to send mails using the CDOSYS object.
But it says , mail sent but mail does not reach me, instead it gives delivery notification (failed),
the mail cud not b delivered to the following email address.

Please help me fast.
'THE MAIL OBJECT 
 Dim ObjMail 
 Set ObjMail = Server.CreateObject("CDO.Message") 
sendUrl="http://schemas.microsoft.com/cdo/configuration/sendusing"
smtpUrl="http://schemas.microsoft.com/cdo/configuration/smtpserver"
 
 
' Set the mail server configuration
Set objConfig=CreateObject("CDO.Configuration")
objConfig.Fields.Item(sendUrl)=cdoSendUsingPickup ' cdoSendUsingPort
objConfig.Fields.Item(smtpUrl)="relay-hosting.secureserver.net"
objConfig.Fields.Update
' Use the config object created above
Set objMail.Configuration=objConfig
 
 
 objMail.From =  "ahdsan@yahoo.co.in" 
 objMail.To = "quickonline.us1@gmail.com"
 objMail.Subject = "Mahesh Tutorials"
 objMail.HTMLBody = a1
 objMail.Send 
 
 Set objMail = Nothing 
 Set objConfig = Nothing

Open in new window

0
Comment
Question by:Desire2change
  • 3
  • 3
6 Comments
 
LVL 17

Expert Comment

by:Shanmuga Sundaram
ID: 22648521
it should be because of the improper mail address or mail settings. also please ensure that gmail will not allow automated mails and check your mail quota.
0
 

Author Comment

by:Desire2change
ID: 22652431
but it is not going to hotmail either.
and i chked with the hosting server, the configuration settings and code everything i have picked up from the hosting server, so i don't think there will b problem with the settings.
please guide me i am clueless.
I am getting the following error :

error '8004020e'
/sendinvoice.asp, line 197
0
 
LVL 17

Expert Comment

by:Shanmuga Sundaram
ID: 22652556
I believe that you are sending mail from yahoo. if that is the case then ensure that yahoo allows send mail via smtp.
if you are using gmail then it uses SSL layer then try the below given code

Sub sendmail()
Dim iMsg As Object
Dim iConf As Object

Dim Flds As Variant

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")

iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "yourmail@gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "yourpasswordhere"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Update
End With

strbody = "Your Sample message "

With iMsg
Set .Configuration = iConf
.To = sendto
.CC = ""
.BCC = ""
' Note: The reply address is not working if you use this Gmail example
' It will use your Gmail address automatic. But you can add this line
' to change the reply address .ReplyTo = "Reply@something.com"
.From = "<your mailid to be displayed as@gmail.com>"
.Subject = "subject here"
.TextBody = strbody
.Send
End With

End Sub
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

Author Comment

by:Desire2change
ID: 22661392
i used the above code and am getting the following error :

CDO.Message.1 error '80040213'

The transport failed to connect to the server.

/sendinvoice.asp, line 204
0
 
LVL 17

Accepted Solution

by:
Shanmuga Sundaram earned 500 total points
ID: 22662389
0
 

Author Closing Comment

by:Desire2change
ID: 31503346
The links helped me to find the solution
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello Friends, My friends and relatives always ask me how to delete all the various types of emails at once in our g-mail  or windows live account.  So I researched this topic to find a unique solution to this query.  Here it is for those who do …
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question