2010-09-16 300 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" /> 
相关问题