By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,853 Members | 1,570 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,853 IT Pros & Developers. It's quick & easy.

Cdonts mail sending Error

P: 27
Hello sir,
When iam trying to send emails to my user accounts which are gmail id's using my application it is giving me this error.
Here is the error...
Server object error 'ASP 0177 : 800401f3'
Server.CreateObject Failed
Not sending CDONTS created e-mails.

Here is the related code ....
Expand|Select|Wrap|Line Numbers
  1. '********************************************************
  2. 'Creating CDONTS mail object and sending mail to user
  3. '********************************************************
  4.  
  5. Sub SendEmail(Sender, Receiver, Subject, Message)
  6.  
  7.         'response.Write(Sender)
  8.         'response.Write(Receiver)
  9.         'response.Write(Subject)
  10.         'response.Write(Message)
  11.         'response.End()
  12.         'based on hosting server we need to enable mailing component
  13.  
  14.         Set Cdo = Server.CreateObject("CDONTS.NewMail")
  15.         Cdo.From = Sender
  16.         Cdo.To = Receiver
  17.         Cdo.Subject = Subject
  18.         Cdo.Body = Message 'Content
  19.         Cdo.BodyFormat = 0        '--->HTML format
  20.         Cdo.MailFormat = 0        '--->HTML format
  21.         '''Response.Write Message & "<br>" 'Displays the content to be sent to receiver
  22.  
  23.         if    Session("UserType")="Participant" then 
  24.             Cdo.Value("Reply-To") = Session("PEmail")
  25.         else
  26.             Cdo.Value("Reply-To") = Sender
  27.         end if
  28.         'response.Write(Message)
  29.         'response.End()
  30.         Cdo.Send 'Sends the mail
  31.  
  32.         'Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
  33.         'Mailer.FromName = "Assessment"
  34.         'Mailer.FromAddress = "rv@gmail.com"
  35.         'Mailer.RemoteHost = "smtp.gmail.com"
  36.  
  37.         ''Here is where you can change who the email is sent to
  38.  
  39.         'Mailer.AddRecipient strFirstname, strToEmail
  40.  
  41.         'Mailer.ContentType = "text/html"
  42.         'Mailer.Subject = "Assessment:New Account Invitation"
  43.         'Mailer.BodyText = strMailbody
  44.  
  45.         'if Mailer.SendMail then
  46.         'response.Write(strMailbody)
  47.         'response.End()
  48.  
  49.         'Call SendEmail("rv@gmail.com", strToEmail, "Assessment:New Account Invitation", strMailbody)
  50.  
  51. End Sub

Please help....as mails are not going to the clients .....some online forums suggest replacing cdo with some thing called cdomessage.....iam new to this asp and do i need to change them or is there any other way....if i need to change and make it work what changes do i make and where.....this code is in common.asp ...



Thanks...
Jason.
Oct 14 '08 #1
Share this Question
Share on Google+
7 Replies


DrBunchman
Expert 100+
P: 979
Hi Jason,

CDONTS is a deprecated object which means that it isn't supported anymore. Take a look at using CDOSYS - there are some excellent examples at w3schools which should help you.

I'd suggest you try one of their example scripts. If you have any problems implementing them then let me know.

Dr B
Oct 14 '08 #2

P: 27
Hi Jason,

CDONTS is a deprecated object which means that it isn't supported anymore. Take a look at using CDOSYS - there are some excellent examples at w3schools which should help you.

I'd suggest you try one of their example scripts. If you have any problems implementing them then let me know.

Dr B
Sir as per ur direction changed the code as below......


Expand|Select|Wrap|Line Numbers
  1. '********************************************************
  2. 'Creating CDOSYS mail object and sending mail to user
  3. '********************************************************
  4.  
  5. Sub SendEmail(Sender, Receiver, Subject, Message)
  6.  
  7.         'response.Write(Sender)
  8.         'response.Write(Receiver)
  9.         'response.Write(Subject)
  10.         'response.Write(Message)
  11.         'response.End()
  12.         'based on hosting server we need to enable mailing component
  13.  
  14.         Set Cdo = Server.CreateObject("CDO.NewMail")
  15.         Cdo.From = Sender
  16.         Cdo.To = Receiver
  17.         Cdo.Subject = Subject
  18.         Cdo.Body = Message 'Content
  19.         Cdo.BodyFormat = 0        '--->HTML format
  20.         Cdo.MailFormat = 0        '--->HTML format
  21.         Cdo.Configuration.Fields.Item _
  22. ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
  23. 'Name or IP of remote SMTP server
  24. Cdo.Configuration.Fields.Item _
  25. ("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
  26. ="smtp.server.com"
  27. 'Server port
  28. Cdo.Configuration.Fields.Item _
  29. ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
  30. =25 
  31. Cdo.Configuration.Fields.Update
  32.         '''Response.Write Message & "<br>" 'Displays the content to be sent to receiver
  33.  
  34.         if    Session("UserType")="Participant" then 
  35.             Cdo.Value("Reply-To") = Session("PEmail")
  36.         else
  37.             Cdo.Value("Reply-To") = Sender
  38.         end if
  39.         'response.Write(Message)
  40.         'response.End()
  41.         Cdo.Send 'Sends the mail
  42.  
  43.         'Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
  44.         'Mailer.FromName = "360 Assessment"
  45.         'Mailer.FromAddress = "sk@gmail.com"
  46.         'Mailer.RemoteHost = "localhost"
  47.  
  48.         ''Here is where you can change who the email is sent to
  49.  
  50.         'Mailer.AddRecipient strFirstname, strToEmail
  51.  
  52.         'Mailer.ContentType = "text/html"
  53.         'Mailer.Subject = "360 Assessment:New Account Invitation"
  54.         'Mailer.BodyText = strMailbody
  55.  
  56.         'if Mailer.SendMail then
  57.         'response.Write(strMailbody)
  58.         'response.End()
  59.  
  60.         'Call SendEmail("sk@gmail.com", strToEmail, "360 Assessment:New Account Invitation", strMailbody)
  61.  
  62. End Sub
  63.  
but still it is giving this error....

Server object error 'ASP 0177 : 800401f3'

Server.CreateObject Failed

/Assessmentweb/Common.asp, line 57


please help....

Thanks...
Jason...
Oct 15 '08 #3

DrBunchman
Expert 100+
P: 979
Hi Jason,

I think you need to change the line where you create your mail object to

Expand|Select|Wrap|Line Numbers
  1. Set Cdo = CreateObject("CDO.Message")
Does that help?

Also, please don't forget to use the # button in the posting window to surround your code with code tags - they make your posts much easier to read and save me and the other moderators time because we don't have to add them for you!!

Thanks,

Dr B
Oct 15 '08 #4

P: 27
Hi Jason,

I think you need to change the line where you create your mail object to

Expand|Select|Wrap|Line Numbers
  1. Set Cdo = CreateObject("CDO.Message")
Does that help?

Also, please don't forget to use the # button in the posting window to surround your code with code tags - they make your posts much easier to read and save me and the other moderators time because we don't have to add them for you!!

Thanks,

Dr B
Sir Tried changing that line as u told no change ...same error is being displayed ...no change in error message also....

Thanks..
Jason.
Oct 15 '08 #5

P: 27
can some one help me with this error please......


Thanks...
Jason.
Oct 17 '08 #6

DrBunchman
Expert 100+
P: 979
Jason,

I've lifted the code below directly from the w3schools page that I linked to above.

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Set myMail=CreateObject("CDO.Message")
  3. myMail.Subject="Sending email with CDO"
  4. myMail.From="mymail@mydomain.com"
  5. myMail.To="someone@somedomain.com"
  6. myMail.TextBody="This is a message."
  7. myMail.Send
  8. set myMail=nothing
  9. %>
If you run this script and you still get the error then perhaps you don't have the CDOSYS.dll installed on your deployment machine? What version of windows/windows server is running on that machine?

Dr B
Oct 17 '08 #7

P: 27
Jason,

I've lifted the code below directly from the w3schools page that I linked to above.

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Set myMail=CreateObject("CDO.Message")
  3. myMail.Subject="Sending email with CDO"
  4. myMail.From="mymail@mydomain.com"
  5. myMail.To="someone@somedomain.com"
  6. myMail.TextBody="This is a message."
  7. myMail.Send
  8. set myMail=nothing
  9. %>
If you run this script and you still get the error then perhaps you don't have the CDOSYS.dll installed on your deployment machine? What version of windows/windows server is running on that machine?

Dr B

hello sir

i ran this but did not get any error ...i ran a script that check for CDOSYS and it says that it is installed....so i also put this script that u gave now and put response.write and when i open the page no error....i get the message...

so what do u say do i need to change any thing on local host to try it ....i specified gmail ids ....did not specify any ports particularly.....


so please let me know ....

thanks..
jason.
Oct 17 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.