Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to send the newsletter to a list of email but every email need modification according to the email address ..
the sending is being processed from another server than the one that is hosted on ..

i make a code that send using System.Net.Mail but after sending to a specific number of emails the
server return an error .. and the sending process fail to continue

the method start by a thread that delay 4sec between every sending process

can any body give me some information about the problem that is happening with me :)

here the code:
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
Posted
Updated 8-Jan-14 22:08pm
v3
Comments
GuyThiebaut 9-Jan-14 3:56am    
"after sending to a specific number of emails the
server return an error" What is the error returned?
I am guessing that you may be marked as a spammer if you do this on a large and regular scale.
How many emails are you sending in one go and how frequently?
Hidhoud1991 9-Jan-14 3:59am    
im sending to my list of contacts that is some how 5000 mail address

im sending it once per day .... its a daily newsletter
Hidhoud1991 9-Jan-14 4:02am    
the list may increase with time according to the number of subscribers to the newsletter
thanks :)
Hidhoud1991 9-Jan-14 4:05am    
these are the errors im getting back from time to time:
*Unable to read data from the transport connection A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
*Recipient address rejected
GuyThiebaut 9-Jan-14 4:14am    
Thanks for your answer.
5000 emails a day is definitely going to flag you as a spammer.

1 solution

The problem is most likely that your hosting service has detected a large number of emails going out, and is preventing you sending any more as it suspects that either you are a spammer or your site has be compromised by a spammer.

The only way round this is to talk to your hosting service, explain exactly what you are doing and ask them for the best way to handle it.
5000+ emails a day, every day, is a lot. Many would consider that as a spam generator.
 
Share this answer
 
Comments
Hidhoud1991 9-Jan-14 4:11am    
one question
what is "mSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network" Used For
and What should i add to make the bounce return to another email address different than the FROM

Thanks
OriginalGriff 9-Jan-14 7:15am    
Google:
https://www.google.co.uk/search?q=SmtpDeliveryMethod.Network&oq=SmtpDeliveryMethod.Network&aqs=chrome..69i57&sourceid=chrome&espv=210&es_sm=93&ie=UTF-8
Leads to MSDN:
http://msdn.microsoft.com/en-us/library/system.net.mail.smtpdeliverymethod(v=vs.110).aspx

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