2010-09-16 306 views
1

我試圖讓Sitecore通過Gmail帳戶發送郵件,但它不會工作。 這是我的設置在web.config中:通過Gmail發送Sitecore電子郵件

<setting name="MailServer" value="smtp.gmail.com" /> 
    <!-- MAIL SERVER USER 
     If the SMTP server requires login, enter the user name in this setting 
    --> 
    <setting name="MailServerUserName" value="[email protected]" /> 
    <!-- MAIL SERVER PASSWORD 
     If the SMTP server requires login, enter the password in this setting 
    --> 
    <setting name="MailServerPassword" value="secret" /> 
    <!-- MAIL SERVER PORT 
     If the SMTP server requires a custom port number, enter the value in this setting. 
     The default value is: 25 
    --> 
    <setting name="MailServerPort" value="587" /> 

這是從日誌中的錯誤:

6068 09:14:57 ERROR Failed to send analytics report 
Exception: System.Net.Mail.SmtpException 
Message: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first.  u9sm3416817eeh.17 
Source: System 
at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response) 
at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, String from) 
at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) 
at System.Net.Mail.SmtpClient.Send(MailMessage message) 
at Sitecore.MainUtil.SendMail(MailMessage message) 
at Sitecore.Analytics.Reports.ReportMailer.Mail(String exportedReportFileName, IEnumerable`1 recipients, String reportTitle, Boolean embedFile, Boolean deleteFile) 

我知道它有事情做與Gmail需要某種形式的安全連接,但我如何讓Sitecore提供這個功能?

回答

2

消息:SMTP服務器需要安全連接或客戶端未通過身份驗證。服務器響應是:5.7.0必須首先發出STARTTLS命令。

gmail需要TLS連接。可以試試看stunnel

無論如何,serverfault或superuser.com可能更合適。

+0

謝謝你,Stunnel的工作作爲一個魅力! – Zooking 2010-09-16 14:17:29

1

Sitecore.MainUtil中的SendMail函數沒有將SmtpClient.EnableSsl設置爲True的選項。目前,它看起來像你將需要找到另一個SMTP服務器使用。

您可能希望將此記錄爲具有Sitecore的功能請求。

0

我使用具有STARTTLS功能的電子郵件營銷活動模塊成功連接到GMAIL。 這裏是我的設置:

 <!--Set it to "true" if you want use the SMTP settings below. You should purchase the right of using the "UseLocalMTA" setting first.--> 
    <setting name="UseLocalMTA" value="true" /> 
    <setting name="SMTP.Server" value="smtp.gmail.com" /> 
    <setting name="SMTP.Port" value="587" /> 
    <setting name="SMTP.LoginDomain" value="" /> 
    <setting name="SMTP.UserName" value="[email protected]" /> 
    <setting name="SMTP.Password" value="12345" /> 
    <setting name="SMTP.AuthMethod" value="PLAIN" /> 
    <setting name="SMTP.StartTLS" value="true" /> 
+0

您可以使用ECM從OMS發送預定的電子郵件嗎? – Zooking 2010-09-21 12:48:12

+1

只能通過定製。我在Analytics.Config中看到analytics:emailreport命令。您可以使用以下代碼以編程方式覆蓋它並從ECM發送電子郵件:var message = Sitecore.Modules.EmailCampaign.HtmlMail.FromItem(messageItem); message.CollectRelativeFiles(); message.Body = ReplaceTokens(message.GetMessageBody(),fields); message.To = to; message.Subject = ReplaceTokens(message.Subject,fields); var manager = new AsyncSendingManager(message); manager.SendQuickTestMessage(); – 2010-09-21 15:00:52

0

在8.2更新4(不知道以前的更新/版本)有一個特殊的設置爲:

<setting name="MailServerUseSsl" value="true" /> 
相關問題