W
Wayne Wengert
I have an aspx page in which I step through emails from a SQL Server table
and snd each a custom email message. The emails in that table are all valid
formats. When I run the page I immediately get the following error message:
----------------------------------
Exception Details: System.Runtime.InteropServices.COMException: The server
rejected one or more recipient addresses. The server response was: 501 5.5.4
Invalid Address
-----------------------------------
None of the emails are actually sent and I have no email address that looks
anything like "5.5.4". The relavent code is below. Any thoughts on what
causes this error message?
============== code ==================
Private Sub SendData(ByVal id As Int32, ByVal email As String)
'Create an instance of the MailMessage class
Dim objMM As New MailMessage
objMM.To = email
objMM.From = "(e-mail address removed)"
objMM.BodyFormat = MailFormat.Html
'Set the priority - options are High, Low, and Normal
objMM.Priority = MailPriority.Normal
'Set the subject
objMM.Subject = "Email Verification"
'Set the body
Dim baseUri As New Uri("http://www.mySite.org/")
Dim myUri As New Uri(baseUri, "verifyemailaddress.aspx?i=" & id.ToString)
objMM.Body = "To verify the email address you have registered with
mySite.org " _
& "please click on the following link: " _
& vbCrLf & "<p/><a href=""" & myUri.ToString & """>" & myUri.ToString &
"</a>" & vbCrLf _
& "<p /> If your email system does not allow active links, copy the link to
your browser's " _
& "address box."
'Specify to use the default Smtp Server
SmtpMail.SmtpServer = "localhost"
SmtpMail.Send(objMM)
End Sub
and snd each a custom email message. The emails in that table are all valid
formats. When I run the page I immediately get the following error message:
----------------------------------
Exception Details: System.Runtime.InteropServices.COMException: The server
rejected one or more recipient addresses. The server response was: 501 5.5.4
Invalid Address
-----------------------------------
None of the emails are actually sent and I have no email address that looks
anything like "5.5.4". The relavent code is below. Any thoughts on what
causes this error message?
============== code ==================
Private Sub SendData(ByVal id As Int32, ByVal email As String)
'Create an instance of the MailMessage class
Dim objMM As New MailMessage
objMM.To = email
objMM.From = "(e-mail address removed)"
objMM.BodyFormat = MailFormat.Html
'Set the priority - options are High, Low, and Normal
objMM.Priority = MailPriority.Normal
'Set the subject
objMM.Subject = "Email Verification"
'Set the body
Dim baseUri As New Uri("http://www.mySite.org/")
Dim myUri As New Uri(baseUri, "verifyemailaddress.aspx?i=" & id.ToString)
objMM.Body = "To verify the email address you have registered with
mySite.org " _
& "please click on the following link: " _
& vbCrLf & "<p/><a href=""" & myUri.ToString & """>" & myUri.ToString &
"</a>" & vbCrLf _
& "<p /> If your email system does not allow active links, copy the link to
your browser's " _
& "address box."
'Specify to use the default Smtp Server
SmtpMail.SmtpServer = "localhost"
SmtpMail.Send(objMM)
End Sub