所以我有一个最近停止工作的smtp邮件设置。asp.net/vb.net - system.net smtp邮件不能正常工作
会发生什么情况是代码从另一个域上的iframe中运行。但是iframe与smtp电子邮件位于同一个域中。
例如:
Main Site --> www.mysite.com
Iframe --> www.myiframe.com
在IFRAME服务器的SMTP是使用system.net设置和工作,直到最近。 SMTP服务器是goddady上office365的代码如下所示:
<system.net>
<mailSettings>
<smtp from="[email protected]" deliveryMethod="Network">
<network host="smtp.office365.com" userName="[email protected]" password="password" defaultCredentials="true" port="587" enableSsl="true" />
</smtp>
</mailSettings>
</system.net>
我所注意到的是,我最近不得不改变从SSL到TLS我所有的电子邮件,以便他们在587.我有工作也测试了我的PHP服务器上的这些smtp设置,它们工作正常,但有一个关键区别。我必须使用SSL定义TLS而不使用SSL我得到失败的认证响应。
我认为可能发生的事情是虽然启用了enablessl
&也应该支持TLS,它不会打扰TLS,并且仅仅是SSL和失败,就是这样。
有没有人知道在system.net中强制使用TLS的方法,或者可能是最近bug的原因。
作为经由意见要求:
Private Sub SendEmail()
Try
Dim smtp As New SmtpClient()
Dim Recipient As String = Request("e").ToString()
Dim name As String = Request("n").ToString()
Dim body As String = File.ReadAllText(ConfigurationManager.AppSettings("DataRoot") & "email.txt").Replace("[firstname]", name)
Dim msg As New MailMessage()
msg.From = New MailAddress(ConfigurationManager.AppSettings("ConfirmEmailFrom"), ConfigurationManager.AppSettings("ConfirmEmailFromName"))
msg.To.Add(New MailAddress(Recipient, name))
msg.Subject = ConfigurationManager.AppSettings("ConfirmEmailSubject")
msg.Body = body
smtp.Send(msg)
Catch ex As Exception
siteMessage.LogMessage("Failed sending confirmation email to " & Request("e").ToString(), ex, Nothing)
End Try
End Sub
你能分享你的代码吗?你已经分享了配置部分。 –
@KaushalKumarPanday完成 – dim