C#.Net Messages are going to spam folder

心已入冬 提交于 2019-12-01 01:00:26

One thing that stands out is that you are never setting the body. I would remove this line:

// Remove the html alternate view
mailMsg.AlternateViews.Add(htmlView);

And try the following (Untested):

// Set the html view to be the default view, leaving the plain text view as the only alternative view
mailMsg.IsBodyHtml = true;
mailMsg.Body = htmlView;

Mails are often marked as spam due to special words in the subject, the sender's domain or the content of the mail or the attaches. So I don't think it has anything to do with the sending mechanism like c# or .NET

There are a whole number of reasons why your email may be marked as spam. This is a good list of how to try to avoid having your emails marked as spam. In my experience though it has been wasier to use a service such as AuthSMTP instead.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!