Click to See Complete Forum and Search --> : ADO Error while sending mail in ASP


TheLastBurden
08-29-2006, 01:53 AM
Am trying to send a mail through an asp page :
Please check the Code n resp. error and guide me where i'm wrong .
First code :

Dim Mail
Set Mail = Server.CreateObject("CDONTS.NewMail")
Mail.From = "me@something.com"
Mail.To = "to@something.com"
Mail.Subject = "Subject : "
Mail.Body = "Body !"
Mail.Send


Error Message :
Server object error 'ASP 0177 : 800401f3'
Server.CreateObject Failed

But one checking the Cause , i found it says to upload the ADO Version from 1.5 to 2 ....whereas i aldready have ADO Version 2.8 ...


Second code :


Dim Mail
Set Mail = Server.CreateObject("CDO.Message")
Mail.From = "me@something.com"
Mail.To = "to@something.com"
Mail.Subject = "Subject : "
Mail.TextBody = "Body !"
Mail.Send()

Error Message :
CDO.Message.1 error '80040220'
The "SendUsing" configuration value is invalid.


Thanks for any help i can get .

championc
08-29-2006, 03:36 AM
You can try the following that works for me

Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "yoursmtpServer"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objCDOSYSCon.Fields.Update
Set objCDOSYSMail.Configuration = objCDOSYSCon
objCDOSYSMail.From = "me@something.com"
objCDOSYSMail.To = "to@something.com"
objCDOSYSMail.Subject = "Subject : "
objCDOSYSMail.HTMLBody = "Body : "
objCDOSYSMail.Send

I think your problem is that you are trying to mail throught an smtp relay which you are not permitted. As far as I remember, this was the same error number that I got at that time. You will have to possibly be careful with the "yoursntpserver" and your "From" address

Hope this helps


Cormac

Terrorke
08-29-2006, 06:17 AM
Make sure you have SMTP installed correctly

TheLastBurden
08-29-2006, 11:33 PM
i tried Cormac's Code..Didn't work...
i have another application using ASP.Net on the same server and the use of "SmtpMail.SmtpServer" to send mails works fine.
So due to time constraint i have converted the application to asp.net ...

TheLastBurden
08-29-2006, 11:34 PM
NevertheLess Thanx .