通常,我使用web.config文件中的SMTP设置和UN/PW到我的Sendgrid帐户发送elmah错误电子邮件。但是,通过两个因素的身份验证,我不认为sendgrid允许发送带有基本身份验证的电子邮件。有没有人知道是否有办法使用API密钥来验证Elmah错误电子邮件?
<elmah>
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="DefaultConnection" />
<errorMail from="error@domain.com" to="email@gmail.com" subject="Exception (test)" smtpServer="smtp.sendgrid.net" smtpPort="587" userName="username" password="password" async="true" />
<security allowRemoteAccess="true" />
</elmah>
谢谢!
发布于 2020-06-11 05:22:10
当启用双因素时,SendGrid不通过基本身份验证提供auth。从他们的文件:
当为用户启用双因素身份验证时,
SendGrid不再接受API调用的基本身份验证(用户名和密码)。现在,如果使用API密钥进行身份验证,则只能使用双因素身份验证。有关更多信息,请参见身份验证。
不过,我相信你可能有机会让这件事发挥作用。尝试将配置中的用户名设置为apikey
,并将密码设置为通过SendGrid生成的API密钥。在这里找到可能的解决方案:https://sendgrid.com/docs/API_Reference/SMTP_API/integrating_with_the_smtp_api.html
https://stackoverflow.com/questions/62309505
复制相似问题