2013-05-22 23 views

回答

7

Sitecore的6.6更新4SendMail功能如下:

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); 
} 

它不包含和日誌功能,所以你需要,如果你需要它添加在你自己的。