Solved

CDO , not  mail sending !

Posted on 2008-10-06
6
680 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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 …
There was an incident about the POP3 issue for the double read receipts and delivery receipts in Exchange 2013.  There was huge research been done and found solution for the duplicate mails. Especially when the user gets  duplicate mails.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

747 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now