Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
Set Flds = objCDOSYSCon.Fields
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "any mail"
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "any password"
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "any server"
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
Flds.update
Set objCDOSYSMail.Configuration = objCDOSYSCon
objCDOSYSMail.From = "any mail"
objCDOSYSMail.To = "any mailid"
'' // objCDOSYSMail.CC = "any mailid"
objCDOSYSMail.Bcc = "any mailid"
objCDOSYSMail.Subject = "feed back"
objCDOSYSMail.HTMLBody = strBody
objCDOSYSMail.Send
Set objCDOSYSMail = Nothing
'' // Response.redirect("thank.html")
response.Write("saved")
Why am I getting an error when trying to send email via port 25
2.9k Views Asked by Tarun AtThere are 3 best solutions below

Change
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
to
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
1 - is seinding via a pickup directory 2 - is sending via SMTP
Looking at your other parameters you are obviously trying to send via port 25.

Try this
Dim objCDOSYSMail Dim objCDOSYSCon Dim Flds Set objCDOSYSMail = Server.CreateObject("CDO.Message") Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration") Set Flds = objCDOSYSCon.Fields With Flds .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "any server" .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "any mail" .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "any password" .Update End With Set objCDOSYSMail.Configuration = objCDOSYSCon 'Sending The Email With objCDOSYSMail .From = "any mail" .To = "any mailid" .Subject = "feed back" .HTMLBody = "my Message" .Send End With 'Disposing Objects Set objCDOSYSMail = Nothing Set objCDOSYSCon = Nothing Set Flds = Nothing
If you don't get any error, check the error log on the server. Make sure that the server can relay email to the email server (smtpserver). This can be done by performing a quick "TELNET Session" from the webserver to the email server. Some SMTP Servers perform a reverse DNS on the senders domain as well. This might sound stupid, but check the username and password as well.
NOTE: Your question was voted down because you did not specify clearly your intention. Next time be "SPECIFIC" and not "PACIFIC" (like the big sea). Most of the people hanging out here are either professionals or trying to be, so at least try to be one.
You might wanna use the open source library ajaxed for that. It detects the component and you dont need to worry about that.
Here is a tutorial on how to send an email.