Forum Moderators: open
With m_objCDO
'Replace with email you wish the message to be sent to
.To = sEmail
'Replace with email you wish the message to be from
.From = "Do@Not.Respond.net"
'Replace with subject
.Subject = "Forgotten Password"
'Replace with information you want to be sent
.HTMLBody = rs("Password")
.Send
End With
•SMTP Server is correct
•SMTP Server Port = 25
•SMTP server requires authentication
•User Name = User Name of pop account
•Password = Password of pop account
Gets error message below, I guess figuring out how to debug SMTP server problems is the next step – any suggestions on doing this, I'm lost?
CDO.Message.1 error '80040213'
The transport failed to connect to the server.
/sendit2.asp, line 95
I have found many similar examples of code on the internet offering solutions to my problem - many provide an authentication portion of code.
Why would many of the solutions I have researched include authentication code with no mention of "... need to use another mail transport like ASPMail."
My problems scenario:
My email account is web based. My MS Outlook is by-passed and remains dormant. I am trying to email the password back to a subscriber upon request via asp. Code looks fine; web host agrees all is fine on their end. I am able to send and receive email between the web host email service and my personal email service. From my error message '80040213', I now know it is a SMTP mail server issue. As to what next step(s) to a solution - I am lost.
Change web host?
Any SMTP mail server issue debug tips appreciated.
Stephen
Example:
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = "Joe’s Widgets Corp."
Mailer.FromAddress= "Joe@Widgets.com"
Mailer.RemoteHost = "mailhost.localisp.net"
Mailer.AddRecipient "John Smith", "jsmith@toolscorp.com"
Mailer.Subject = "Great SMTP Product!"
Mailer.BodyText = "Dear Stephen" & VbCrLf & "Your widgets order has been processed!"
if Mailer.SendMail then
Response.Write "Mail sent..."
else
Response.Write "Mail send failure. Error was " & Mailer.Response
end if
•SMTP server requires authentication
CDO Cannot Authenticate. How can your Host Provider say the code looks fine AND their SMTP server requires authentication.
If they do not allow CDO, what other Mail Object(s) do they have available for you to use? ASPMail is one of those options if they have the DLL installed.
The link below is the source for the following:
[eggheadcafe.com...]
Many people think that you cannot authenticate a SMTP server using the System.Web.Mail.MailMessage class and opt paying for an alternative.
Well heres a solution that may save you some money.
Dim Msg As New System.Web.Mail.MailMessage
Msg.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtpserver"
Msg.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
Msg.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
Msg.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
Msg.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "username"
Msg.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
Msg.To = "dst@addr.net"
Msg.From = "src@addr.net"
Msg.Subject = "Subject"
Msg.Body = "Message"
System.Web.Mail.SmtpMail.SmtpServer = "smtpserver"
System.Web.Mail.SmtpMail.Send(Msg)
This example is for a remote server, to authenticate the localhost you do not need to set the smtpserver field or the smtpserverport field.
Just change the sendusing field to 1 & SmtpMail.SmtpServer to localhost
For more things you can do with the MailMessage Class check out MSDN at [msdn.microsoft.com...]
Source: Spooky on
[frontpagewebmaster.com...]
<%
Set oMail = Server.CreateObject("CDO.Message")
Set iConf = Server.CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
'Local service (dont change)
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "http://127.0.0.1"
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
iConf.Fields.Update
Set oMail.Configuration = iConf
oMail.To = "somebody@msn.com"
oMail.From = "webmaster@xyz.com"
oMail.Subject = "Subject: testing"
oMail.TextBody = "Body: just some message"
oMail.Send
Set iConf = Nothing
Set Flds = Nothing
%>