2014-10-06 2 views
1

C#/ASP.NET로 작성된 웹 앱에서 이메일을 보내려고합니다.Gmail, Yahoo, Hotmail로 이메일이 배달되지 않습니다.

전자 메일의 HTML 버전과 텍스트 버전을 모두 보내려고합니다. 그러나 Gmail, Yahoo, Hotmail, AOL 등의 이메일 주소로 보내려고하면받은 편지함에 나타나지 않습니다.

텍스트를 HTML 대체보기없이 엄격하게 보내면 잘 전달됩니다.

여기있는 사람이이 경험이 있습니까?

이메일은 우리의 호스팅 Exchange 서버 "@ mxxx.com"

덕분에 잘 전달!

EDIT : 한 가지 더. 전자 메일이 배달되지 않으면 우리는 배달 실패 통지를받지 못합니다. 전자 메일은 근본적으로 사라집니다.

코드 :

// email the user 
       MailMessage message = new MailMessage("[email protected]", user.EmailAddress); 
       message.Bcc.Add("[email protected]"); 
       message.Bcc.Add("[email protected]"); 
       message.Bcc.Add("[email protected]"); 
       message.Subject = "Your \"mxxx.com\" password has been reset"; 
       message.ReplyToList.Add(new MailAddress("[email protected]")); 
       message.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure | DeliveryNotificationOptions.Delay | 
                 DeliveryNotificationOptions.OnSuccess; 
       message.Sender = new MailAddress("[email protected]"); 

       string htmlbody = "<html><body><p>Dear " + name + ":</p>" + 
       "<p>Your password at \"mxxx.com\" has been reset to: " + newPassword + "</p>" + 
       </body></html>"; 

       var plainTextBody = "test plain text"; 

       AlternateView plainTextView = 
        AlternateView.CreateAlternateViewFromString(
         plainTextBody, message.BodyEncoding, MediaTypeNames.Text.Plain); 

       plainTextView.TransferEncoding = TransferEncoding.Base64; 
       message.AlternateViews.Add(plainTextView); 

       AlternateView htmlview = 
        AlternateView.CreateAlternateViewFromString(
         htmlbody, message.BodyEncoding, MediaTypeNames.Text.Html); 

       htmlview.TransferEncoding = TransferEncoding.Base64; 

       message.AlternateViews.Add(htmlview); 



       SmtpClient mailMan = new SmtpClient(); 
       mailMan.Send(message); 
+1

하드 테스트를 고려,하지만 난 그 서비스가 스팸 필터의 요인 중 하나로 HTML 콘텐츠를 사용 의심 - 클릭 HTML 링크가있을 때 스팸 메일이 더 효과적이다 에, 그래서 약간 html을 사용하는 경향이있다. SMTP 서버의 rDNS, DKIM 또는 SPF 레코드 등의 측면에서 100 % 완벽하지 않은 메시지와 결합하면 메시지가 블랙홀로 전송됩니다. 그래서 평상시처럼 평판이 좋은 전자 메일 마케팅 서비스를 항상 사용하는 것이 좋습니다. –

+0

@JoelCoehoorn 알겠습니다. 우리는 분명히 어떤 블랙홀로 보내지고 있으며, 거부당한 이메일이나 보내진 후에는 아무런 흔적도 없습니다. – bsqrd7

답변

0

당신이 AlternateView를 사용하고 몸이 HTML로 지정되지 않도록 유의? 확실히 말할 다음 조각?

  MailMessage message = new MailMessage("[email protected]", user.EmailAddress); 
      message.Bcc.Add("[email protected]"); 
      message.Bcc.Add("[email protected]"); 
      message.Bcc.Add("[email protected]"); 
      message.Subject = "Your \"mxxx.com\" password has been reset"; 
      message.ReplyToList.Add(new MailAddress("[email protected]")); 
      message.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure | DeliveryNotificationOptions.Delay | 
                DeliveryNotificationOptions.OnSuccess; 
      message.Sender = new MailAddress("[email protected]"); 

      string htmlbody = "<html><body><p>Dear " + name + ":</p>" + 
      "<p>Your password at \"mxxx.com\" has been reset to: " + newPassword + "</p>" + 
      </body></html>"; 

      message.Body = htmlbody; 
      message.IsBodyHtml = true; 
      SmtpClient mailMan = new SmtpClient(); 
      mailMan.Send(message); 
+0

원래는 그게 좋았고 메시지는 여전히 전달되지 않았습니다. Google Hosted Exchange에서 수신되었지만 HTML 대신 텍스트 버전이 표시되었습니다. – bsqrd7

+0

* message *를 인스턴스화 할 때 * IsBodyHtml = true; * so * message.IsBodyHtml = true; *를 설정 한 다음 * mailMan.Send (message) *를 설정하면 –

관련 문제