Thursday, March 22, 2012

SMTPMail Error

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 = "webmaster@dotnet.itags.org.mySite.org"

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="http://links.10026.com/?link="" & 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 Subthe problem may be the address in your "from" field, some smtp servers are
configured to reject all emails that come from unknown senders. so try and
create a pop account and then try to send FROM that address. Hope that
helps.
Regards,
Alejandro Penate-Diaz

"Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
news:%23CQSRvMYFHA.1044@.TK2MSFTNGP10.phx.gbl...
>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 = "webmaster@.mySite.org"
>
> 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="http://links.10026.com/?link="" & 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
Alejandro;

Thanks for the response. I ran some test and I find that if I limit the list
of emails to send to 1 or 2, it works? When I let it try to loop through the
whole list (175 addressees) I get the error.

Is there some way I can tell it to "wait" untile the current email is sent
before I send the next one?

Wayne

"Alejandro Penate-Diaz" <alexware69@.hotmail.com> wrote in message
news:e3xSMfNYFHA.3584@.TK2MSFTNGP12.phx.gbl...
> the problem may be the address in your "from" field, some smtp servers are
> configured to reject all emails that come from unknown senders. so try and
> create a pop account and then try to send FROM that address. Hope that
> helps.
> Regards,
> Alejandro Penate-Diaz
>
> "Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
> news:%23CQSRvMYFHA.1044@.TK2MSFTNGP10.phx.gbl...
>>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 = "webmaster@.mySite.org"
>>
>>
>>
>> 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="http://links.10026.com/?link="" & 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
>>
>>

0 comments:

Post a Comment