I'm developing a newsletter subsystem.
The user enters a newsletter content in HTML-editor and sends an email to the list of his customers.
This is an ASP.NET application. The mail server is MS Exchange.
The problem is that real letters with pretty complex html don't reach recipients. Since test email sending works just fine. Moreover if we take a single recipient first few letters arrive and then they just don't come. If we try another address it will work for few times, and then stop arriving again. Junk folder is empty. server logs are empty. No errors. Emails just disappear without a trace.
Here is my code (simplified and changed a little).
Email sending code:
Mailer mailer = new Mailer();
foreach(ClientAddress address in addresses) {
mailer.SendEmail(address.Mail, address.Consultant.Email, newsletter.Topic, newsletter.Content);
}
Mailer:
public class Mailer {
public virtual void SendEmail(string toAddress, string replyTo, string subject, string text) {
MailMessage message = new MailMessage();
message.From = new MailAddress(Globals.Settings.Mail.SmtpClientAddress);
message.ReplyToList.Add(new MailAddress(replyTo));
message.From = new MailAddress(toAddress);
message.Subject = subject;
message.IsBodyHtml = true;
message.Body = text;
SmtpClient client = new SmtpClient(Globals.Settings.Mail.SmtpServer, Globals.Settings.Mail.SmtpPort);
client.Credentials = new NetworkCredential(Globals.Settings.Mail.SmtpClientName, Globals.Settings.Mail.SmtpClientPassword);
client.Send(message);
}
}
Mailing configuration:
server="exchange.server.com"
port="25"
clientAddress="user@exchange.server.com"
clientName="user@exchange.server.com"
clientPassword="***" />
I heard that emails with html body can be blocked by mail servers.
How to overcome this? How services like http://mailchimp.com/ solve this problem?
Thanks in advance for any help.