-5
我使用的方法來發送電子郵件:發送電子郵件進入垃圾
public void Enviar(MailAddress from, MailPriority prioridade)
{
SmtpClient client = new SmtpClient(new PartnerDB().ParServidorSMTP);
MailMessage mail = new MailMessage();
mail.From = from;
mail.Subject = this.Assunto;
mail.Priority = prioridade;
mail.IsBodyHtml = true;
mail.Body = this.Conteudo;
foreach (var email in this.Para) mail.To.Add(new MailAddress(email));
foreach (var email in this.Copia) mail.CC.Add(new MailAddress(email));
foreach (var email in this.CopiaOculta) mail.Bcc.Add(new MailAddress(email));
foreach (var anexo in this.CaminhoAnexos) mail.Attachments.Add(new Attachment(anexo));
foreach (var anexo in this.StreamAnexos) mail.Attachments.Add(new Attachment(anexo.StreamBytes, anexo.MimeType));
try
{
client.Send(mail);
}
catch (Exception ex)
{
Log.Instancia.LogError(new SiteSession().User.Login, "SendMail.Enviar", ex, this.Assunto);
}
mail.Dispose();
}
調用方法改變的電子郵件地址和一個不言而喻的垃圾郵件,與其他不一樣,下面exempla:
{
string corpo = "Testing email via C#";
var mail = new SendMail("[email protected]", "subject testing via c# eduardo", corpo);
mail.Enviar(new MailAddress("[email protected]"), MailPriority.High);
}
{
string corpo = "Testing email via C#";
var mail = new SendMail("[email protected]", "subject testing via c# leanndro", corpo);
mail.Enviar(new MailAddress("[email protected]"), MailPriority.High);
}
當我使用MailAddress(from)作爲'[email protected]'時,電子郵件會轉到垃圾郵件,但是當我使用'[email protected]'時,它會更正收件箱(而不是垃圾郵件) ,有人知道告訴我爲什麼?
非常感謝!
您的郵件服務器不允許從Hotmail發送電子郵件。 – SLaks
如果您看到來自「xxx」的電子郵件,您不會打開它嗎? :無論如何,這是因爲客戶的規則......它與你的代碼無關。發件人與主題的組合可能會導致此問題被視爲垃圾郵件) –
您的電子郵件正在與您的電子郵件的名稱一起發送,但不是來自hotmail服務器,這使它看起來是「假的」。 – Cyral