1

有谁知道 SitecoreSitecore.MainUtil.SendMail功能具有编写有关已发送邮件的日志的标准功能?是否可以开启?或者我需要使用我的自定义日志吗?

谢谢。

4

1 回答 1

7

Sitecore 6.6 update 4 SendMail中,函数如下所示:

public static void SendMail(System.Net.Mail.MailMessage message)
{
  string mailServer = Settings.MailServer;
  SmtpClient smtpClient;
  if (string.IsNullOrEmpty(mailServer))
  {
    smtpClient = new SmtpClient();
  }
  else
  {
    int mailServerPort = Settings.MailServerPort;
    smtpClient = mailServerPort <= 0 ? new SmtpClient(mailServer) : new SmtpClient(mailServer, mailServerPort);
  }
  string mailServerUserName = Settings.MailServerUserName;
  if (mailServerUserName.Length > 0)
  {
    string mailServerPassword = Settings.MailServerPassword;
    NetworkCredential networkCredential = new NetworkCredential(mailServerUserName, mailServerPassword);
    smtpClient.Credentials = (ICredentialsByHost) networkCredential;
  }
  smtpClient.Send(message);
}

它不包含和记录功能,因此如果需要,您需要自行添加。

于 2013-05-22T09:21:13.463 回答