0

我正在使用 Smtp 发送邮件。消息已成功发送,但未送达。这是什么原因。这是邮件服务器的问题吗?过去几年消息发送过程运行良好。问题是第一次出现。

public bool SendMail(string p_strFrom, string p_strDisplayName, string p_strTo, string p_strSubject, string p_strMessage , string strFileName)
 {
     try
     {
         p_strDisplayName = _DisplayName;
         string smtpserver = _SmtpServer;
         SmtpClient smtpClient = new SmtpClient();
         MailMessage message = new MailMessage();
         MailAddress fromAddress = new MailAddress(_From,_DisplayName);
         smtpClient.Host = _SmtpServer;
         smtpClient.Port = Convert.ToInt32(_Port);
         string strAuth_UserName = _UserName;
         string strAuth_Password = _Password;
         if (strAuth_UserName != null)
         {
             System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential(strAuth_UserName, strAuth_Password);
             smtpClient.UseDefaultCredentials = false;
             if (_SSL)
             {
                 smtpClient.EnableSsl = true;
             }
             smtpClient.Credentials = SMTPUserInfo;
         }
         message.From = fromAddress;

         message.Subject = p_strSubject;
         message.IsBodyHtml = true;
         message.Body = p_strMessage;
         message.To.Add(p_strTo);
         try
         {
             smtpClient.Send(message);
             Log.WriteSpecialLog("smtpClient mail sending first try success", "");
         }
          catch (Exception ee)
         {
             Log.WriteSpecialLog("smtpClient mail sending first try Failed : " + ee.ToString(), "");
             return false;
         }
         return true;
     }
     catch (Exception ex)
     {
         Log.WriteLog("smtpClient mail sending overall failed : " + ex.ToString());  
         return false;
     }
 }
4

1 回答 1

0

消息已成功发送,但未送达

如果它是从您的邮件服务器成功发送的,那么未投递的可能原因可能是客户端上的邮件过滤器阻止了它或以垃圾邮件的形式投递。

于 2013-08-16T05:42:21.837 回答