I am building a newsletter app, and have been running into some seemingly random and frustrating mail problems involving routing messages to pop mailboxes.
I have tried several third party mail components as well as those found in System.Web.Mail, and they all produce the same strange results.
Whenever I try to route a message to a webmail client (hotmail, etc), the mail is successfully delivered - always. Whenever I try to mail to a popmail client, the SMTP.Send method reports a successful delivery(most of the time), but the mail never arrives. On some SMTP servers I have tried, a 550 Invalid recipient error is posted when an send is attempted on a pop mailbox.
Could it be an environment thing? Are there any corelations between the mail api's and the local mapi profiles? I am having particularly frustrating issues with the popmail accounts configured in my outlook profile.
Have tried disabling my OS firewall, my AntiVirus (including mail scans), my router firewall..... I have tried it using the localhost domain in the url - along with the natted ip and the wan ip. (have not tried it on a foreign environment yet). I have mixed up mailboxes thinking that some sort of bizarre spamming program might be blocking the mail (delivery for pop works *sometimes* and then suddenly stops for no apparent reason).
The code I have been using is nothing at all exotic. Here is the code using System.Web.Mail:
MailMessage mail = new MailMessage();
mail.To=email.Text;
mail.From="
[email protected]";
mail.Subject="a subject";
mail.Body=body.Text;
SmtpMail.SmtpServer="192.168.2.100"; //Have tried mixing this up
SmtpMail.Send(mail);
I have also used devMail's component:
MailMessage mail = new MailMessage();
mail.Subject=title;
mail.To.Add((string)row["firstname"]+(string)row["lastname"],(string)row["email"]);
mail.From.EMail=settings.SenderEmail;
mail.From.Name=settings.SenderName;
mail.HTMLMessage.Body=body;
mail.PlainMessage.Body="foo";
mail.ReplyTo.EMail=settings.SenderEmail;
mail.SMTPServer.Host=settings.SmtpServer;
mail.SMTPServer.Username=settings.SmtpUser;
mail.SMTPServer.Password=settings.SmtpPassword;
mail.SMTPServer.AuthenticationMode = SMTPAuthenticationMode.CRAM_MD5;
bool successTry=mail.Send();
Any help at all would be most appreciated....
Ben