私は電子メールを送信するELMAHを設定しようとしているが、私は次のエラーを取得しています:ELMAHからメールを送る方法は?
Server Error in '/' Application.
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. 59sm11486886otw.9 - gsmtp
私はこの同じエラーにはいくつかの記事を見てきましたが、のいずれの方法でも働いていません。
ELMAHはSQL Serverにエラーを記録しています。
MailMessage mailx = new MailMessage();
mailx.To.Add("mySendTo");
mailx.From = new MailAddress("mySendFrom");
mailx.Subject = "My Subject";
mailx.Body = string.Format("My email body");
mailx.IsBodyHtml = true;
SmtpClient smtpx = new SmtpClient();
smtpx.Host = "smtp.gmail.com";
smtpx.Port = 587;
smtpx.UseDefaultCredentials = false;
smtpx.Credentials = new System.Net.NetworkCredential("MyLoginUser", "MyLoginPwd");
smtpx.EnableSsl = true;
smtpx.Send(mailx);
のWeb.Configはfolowing ELMAHの情報が含まれています:
また、私はELMAHはそう使用するのと同じ資格情報を使用してSMTPメールを送信することができる午前私は認証エラーを持っていないと思います私はテスト環境でSSLを利用しないのDev環境にし、それを試してみました1.2.13605.0
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<sectionGroup name="elmah">
<section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
<section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
<section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
<section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
</sectionGroup>
</configSections>
<appSettings>
<add key="elmah.mvc.disableHandler" value="false" />
<add key="elmah.mvc.disableHandleErrorFilter" value="false" />
<add key="elmah.mvc.requiresAuthentication" value="true" />
<add key="elmah.mvc.IgnoreDefaultRoute" value="false" />
<add key="elmah.mvc.allowedRoles" value="*" />
<add key="elmah.mvc.allowedUsers" value="[email protected], [email protected]" />
<add key="elmah.mvc.route" value="elmah" />
<add key="elmah.mvc.UserAuthCaseSensitive" value="true" />
</appSettings>
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
</httpModules>
<modules>
<remove name="FormsAuthentication" />
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
</modules>
<system.net>
<mailSettings>
<smtp deliveryMethod="Network">
<network host="smtp.gmail.com" port="587" userName="MyUserName" password="MyUserPwd" defaultCredentials="false"/>
</smtp>
</mailSettings>
</system.net>
<elmah>
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="DefaultConnection" />
<security allowRemoteAccess="yes" />
<errorMail
from="[email protected]" to="mySendTo" subject="MySubject" async="false" smtpPort="587" useSSL="true"/>
</elmah>
</configuration>
使用中のELMAHのバージョンがありますSSL証明書を持っています。どちらも同じエラーがあります。
私はSOの投稿にある多くの推奨事項を試しましたが、どれもうまくいきませんでした。
Unable to configure mail for Elmah
Send email from Elmah?
Elmah not sending Email
elmah - cannot email exceptions
私はuseSSLを使用してSSLを使用していました。助けてくれてありがとう。 – John