关于经典ASP和Office 365有几个问题,但似乎没有回答我的特定情况,所以在这里。办公室365和经典ASP与VB.net SMTP设置
我建立一个电子邮件帐户的Office 365,我试图做一个SMTP测试用下面的代码:
Dim ObjSendMail, mailSubject, mailBody
Set ObjSendMail = CreateObject("CDO.Message")
mailSubject = "Test"
mailBody = "Test"
ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.office365.com"
ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 240
ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "[email protected]"
ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
ObjSendMail.Configuration.Fields.Update
ObjSendMail.To = "[email protected]"
ObjSendMail.Subject = mailSubject
ObjSendMail.From = """From Name"" <[email protected]>"
'ObjSendMail.HTMLBody = "this is the body"
ObjSendMail.TextBody = mailBody
ObjSendMail.Send
这会产生以下错误:
CDO.Message.1错误“ 80040213'
传输失败连接到服务器。
我已经知道这是由于smtpusessl设置,但我需要,如果我把它关闭,我会得到错误“8004020e”。
现在,这里的奇怪的事情......我能做成功地利用VB.net和下面的代码SMTP测试:
Dim mailClient As New SmtpClient("smtp.office365.com")
mailClient.Port = 587
mailClient.EnableSsl = True
'Your network credentials are going to be the Office 365 email address and the password
Dim cred As New System.Net.NetworkCredential("[email protected]", "password")
mailClient.Credentials = cred
Dim message As New MailMessage()
message.From = New MailAddress("[email protected]", "From Name")
message.[To].Add("[email protected]")
message.Subject = "Test Office 365 SMTP"
message.Body = "Test Body"
mailClient.Send(message)
这告诉我,我不应该需要在配置我的东西服务器,以获得经典的ASP版本工作......这是我工作的网站是内置的。我的问题是...我错过了什么愚蠢的设置将摆脱运输错误?
谢谢。
右键 - 您不需要在Office 365端配置任何能够通过ASP.NET发送电子邮件的东西。我有点困惑 - 为什么要问关于修复传输错误,如果它可以正常使用vb代码? – Andarta
因为ASP.net代码是测试代码,以查看我是否拥有正确的身份验证凭证,服务器等。我正在使用的购物车内置经典ASP。 – SEFL