Sending letters. very confusing

Hi my name, my name is who .. ops got carried away

Now this might be a serverfault question and a stackoverflow question, but I'll go with it here because I don't really know the answer.

I have sent mail a lot with asp.net before and never had the same issues as before. I have set up mail with this following code

var list = new List<string> { "mail", "mail", "mail", "mail" };

        var smtp = new SmtpClient("localhost", 25);
        var plainText = txtPlain.Text;
        var htmlText = Server.HtmlDecode(FCKeditor1.Value);

        foreach (var email in list)
        {
            var message = new MailMessage()
                          {
                              From = new MailAddress("my server mail"),
                              ReplyTo = new MailAddress("mail")
                          };

            var mailMessage = Server.HtmlDecode(FCKeditor1.Value);
            message.To.Add(email);
            message.Subject = "title";
            message.Body = mailMessage;
            message.IsBodyHtml = true;
            message.BodyEncoding = System.Text.Encoding.GetEncoding("iso-8859-2");

            var alternateViewHtml = AlternateView.CreateAlternateViewFromString(htmlText, null, MediaTypeNames.Text.Html);
            var alternateViewPlainText = AlternateView.CreateAlternateViewFromString(plainText, null, MediaTypeNames.Text.Plain);

            message.AlternateViews.Add(alternateViewHtml);
            message.AlternateViews.Add(alternateViewPlainText);

            smtp.Send(message);
        }

      

now the problem is that some email clients just get one and some get html. As on my hotmail on a computer I get html but on my iphone I get simple. Why is this?

and the like was not enough. The post did not deliver to the post office, like any .pl email. Now here is where I think it might be a reverse DNS setup on my Windows Server 2008 server, I had the same problem with hotmail, but it got resolved when I added plain. Has anyone had a problem before?

I am very grateful for any answer I get .. thanks

EDIT some company posts, this will become spam / Received a response after looking at it, please feel free to let me know more

+2


source to share


1 answer


You put the HTML version of the post in Message.Body

and install IsBodyHtml = true

So why are you duplicating the html component the second time, buy sending the alternate HTML submission ... I think it might be overkill. try deleting two lines

        message.Body = mailMessage;
        message.IsBodyHtml = true;

      



Also, double check these values MediaTypeNames.Text.PROPERTY

and make sure they return text/plain

andtext/html

http://www.andreas-kraus.net/blog/tips-for-avoiding-spam-filters-with-systemnetmail/

+1


source







All Articles