Click here to Skip to main content
15,911,030 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
Dim mSmtpClient As New SmtpClient(S_Smtp, S_port)
            Dim mMailmessage As New MailMessage
 
            Try
                mSmtpClient.Credentials = New System.Net.NetworkCredential(S_User, S_pass)
               
                mMailmessage.ReplyToList.Add(New MailAddress(S_replyto))
              
                mMailmessage.From = New MailAddress(sender & "<" & S_User & ">")
                mMailmessage.Subject = subject
 
                Dim Overallmail As Integer = str.Rows.Count
               
 
                   
                    
   '-------------------start Sending---------------------------------------------------------
                    For i = 0 To str.Rows.Count - 1
 
   
                            Dim bodymail As String = body
                            email = str.Rows(i).Item(0).ToString
 
                    bodymail = bodymail.Replace(oldmail, email).Replace("[email]", email)
                    htmlView = System.Net.Mail.AlternateView.CreateAlternateViewFromString(bodymail, Nothing, "text/html")
 
                    'mSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network

                                mMailmessage.AlternateViews.Add(htmlView)
                                mMailmessage.IsBodyHtml = True
                                'execute too fast to see the thread working.  
                                mMailmessage.[To].Add(New MailAddress(email))
 
                                '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

                                mSmtpClient.Send(mMailmessage)
 
                                '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

                                mMailmessage.To.Clear()
                                mMailmessage.AlternateViews.Clear()
 
                             
 
                                Thread.Sleep(oXMLparams.GetParamValue("EmailEvery"))
 
                            End If




This method is returning an error which is :The server response was: 5.1.1 : Recipient address rejected: User unknown in virtual mailbox table

i think one of the emails that im sending to is not valid but its syntax is true

what could i add to the sending method to ignore this kind of mails and set it as bounce and not to stop the sending process

thanks
Posted

 
Share this answer
 
Comments
Hidhoud1991 13-Jan-14 7:14am    
The sending method i wrote is correct but the error that is thrown is stopping the method i need to put try catch with the errors that i may face but i dont know these errors
If you look at Understanding Email Errors[^]
Quote:

Permanent Problems


The most common permanent user problem is, of course, User Unknown. The account you are trying to mail no longer exists - it may have been shut down, or you may have misspelled the username or domain (make sure you check email error messages carefully). The following are all examples of User Unknown messages:


<user@earthlink.net>: host condor.prod.itd.earthlink.net said:
550 <user@earthlink.net>... User unknown

<user@hotmail.com>: host mail7.hotmail.com said:
550 Requested action not taken: mailbox unavailable

<user@apc.net>: host mail.apc.net said:
550 5.1.1 <user@apc.net> is not a valid mailbox

<user@riviera.org.uk>: Sorry, no mailbox here by that name. (#5.1.1)

<user@saccny.org>: host hhh.net said:
550 Invalid recipient <user@saccny.org>

The message that you sent was undeliverable to the following:
user@ashrosary.org (user not found)

If you receive a user unknown bounce, and you have checked to make sure the address is correct, the next thing you should do is try to contact the person you were trying to email by other means. Frequently, people are not aware that they are bouncing email until someone else tells them. Also, do not delete the bounce message. It can help the user and their ISP resolve why they are bouncing mail more quickly.


If you do not have other means to contact the person who is bouncing mail, you probably have a dead email address. Try mailing them one more time (preferably at least a day later) in case it was a technical problem, but after that, stop using that email address. If you run a mailing list, and one of your subscribers starts bouncing mail with this error, remove them from the list.


, then you would probably think that it recipient's fault, not your's. :)

Also take a look at reason: 550 5.1.1 : Recipient address rejected: User unknown in virtual mailbox table[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900