Cdo message 1 ошибка 80040213

CDO.Message.1 error '80040213'

The transport failed to connect to the server.

/check.asp, line 25

please help to solve this problem

check this code

<%@ Language=VBScript %>
<html>
<head>
</head>
<body>
<%
dim to_field, message
to_field = Request.Form("to_field")
message = Request.Form("message")
'Create the e-mail server object
Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
'Out going SMTP server
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.example.com"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objCDOSYSCon.Fields.Update
'Update the CDOSYS Configuration
Set objCDOSYSMail.Configuration = objCDOSYSCon
objCDOSYSMail.From = "admin@example.com" ' the address you want the email to be from
objCDOSYSMail.TO = "anuradha@gmail.com"  'the address the mail is to be sent to
objCDOSYSMail.Subject = "Subject goes here"
objCDOSYSMail.HTMLBody = "fffffffffff"
objCDOSYSMail.Send
'Close the server mail object
Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing
%>
<p>Mail sent successfully to address <%=to_field%>!</p>
</body>
</html>

Kenster's user avatar

Kenster

23.1k21 gold badges80 silver badges106 bronze badges

asked Dec 2, 2010 at 8:31

anuradha's user avatar

You need to add your user name and password before sending. This is because you used a value of 2 in the sendusing‘s field. This means you’re using authentication.

'Your UserID on the SMTP server'
objCDOSYSCon.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "yourusername"

'Your password on the SMTP server'
objCDOSYSCon.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "yourpassword"

Jonathan de M.'s user avatar

answered Jun 28, 2011 at 0:40

Yukon's user avatar

YukonYukon

711 silver badge2 bronze badges

У меня есть Windows Server 2003 R2 с IIS и веб-сайт с классическим ASP. Попытка заставить его использовать CDOSYS для электронной почты с помощью нашего собственного (внешнего) размещенного сервера обмена office365.

Я получаю следующую ошибку

CDO.Message.1 error '80040213'
The transport failed to connect to the server.

Обычно это означает одну из трех проблем: 1. Неверный SMTP-сервер / порт 2. Неверный логин / пароль 3. Адрес FROM недействителен согласно SMTP-серверу (неправильный домен)

SMTP-сервер и порт указаны поставщиком правильно. Логин / пароль верны, так как я могу войти в учетную запись электронной почты, используя эти данные. Адрес FROM правильный, поскольку это учетная запись, которую я использую для входа.

Я могу подключиться к серверу обмена по telnet с веб-сервера на этом адресе и порту, поэтому соединение может быть выполнено по крайней мере с сервера.

Так что на данный момент я не понимаю, в чем может быть проблема. Есть ли у кого-нибудь указатели на что-нибудь еще, на что мне нужно взглянуть?

Это конфигурация, которую использует веб-сайт

myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2 
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.office365.com"
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=587
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 20
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "username"
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"

4 ответа

Лучший ответ

Ну, в конце концов, я решил эту проблему. Мне нужно было использовать другой метод подключения к серверу office365. Так что теперь все работает как надо.


0

chenks
2 Янв 2017 в 08:40

Попробуйте Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25

В Office 365 cdo, похоже, предпочитает порт 25 даже при использовании проверки подлинности.

Вот проверенная конфигурация, если она поможет

Set iConfg = Server.CreateObject("CDO.Configuration")
Set Flds = iConfg.Fields
With Flds
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.office365.com"
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "myusername"
        .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypassword"
        .Update
End With
objMail.Configuration = iConfg


0

John
10 Дек 2016 в 15:15

Пытаться

.Item("http://schemas.microsoft.com/cdo/configuration/smtpsendtls") = 1

Вместо

.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1


0

Robert Columbia
26 Окт 2018 в 04:37

Вы настроили ретранслятор SMTP в Office 365?

От администратора Office 365 перейдите к:

  1. Админ> Обмен
  2. Почтовый поток> Коннекторы
  3. Нажмите добавить новый коннектор ретрансляции SMTP.
  4. Выберите от «почтовый сервер вашей организации» до «office 365».
  5. Дайте соединителю имя и описание
  6. Выберите подтверждение по IP-адресу и добавьте IP-адрес своего веб-сервера.
  7. Сохранить


0

George O’Sullivan
10 Дек 2016 в 13:51

I’m trying to send an contact enquiry email from a legacy classic asp script using a Google Apps account as the SMTP server. The code I have to test this is as follows:

Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message") 

'This section provides the configuration information for the remote SMTP server.
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.thedomain.com"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465 ' or 587
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

' Google apps mail servers require outgoing authentication. Use a valid email address and password registered with Google Apps.
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="info@thedomain.com" 'your Google apps mailbox address
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="password" 'Google apps password for that mailbox

ObjSendMail.Configuration.Fields.Update

ObjSendMail.To = "me@mydomain.net"
ObjSendMail.Subject = "this is the subject"
ObjSendMail.From = "info@thedomain.com"

' we are sending a text email.. simply switch the comments around to send an html email instead
'ObjSendMail.HTMLBody = "this is the body"
ObjSendMail.TextBody = "this is the body"

ObjSendMail.Send
Set ObjSendMail = Nothing 

I’ve tried both port numbers 465 and 587. I’ve tried mail.thedomain.com and smtp.thedomain.com and mail.gmail.com and smtp.gmail.com as the SMTP server, but nothing works. I’ve logged into the Google Apps account with the email address and password in the script, so those details are definitely correct.

All I can get though is the following error:

CDO.Message.1 error '80040213'

The transport failed to connect to the server.

/_test-email.asp, line 46 

(line 46 is where it says ObjSendMail.Send)

Can anyone see what might be wrong?

Thanks folks!

User470141560 posted

Hello everyone

I am having trouble auto-mailing via ASP Classic running under Windows Server 2012 r2; the error code is as follows:

CDO.Message.1 error
‘80040213’

The
transport failed to connect to the server.

/EnviaCorreo.asp,
line 31

I was researching the error on the internet and most comment that it is due to changing port 587 to 25 since I am using an Office365 account, I pass the configuration:

Function EnviaMail(sDesde,sDestinatario,sCC,sAsunto,sCuerpo,html)
	Dim oMail,configMail

	Set oMail = Server.CreateObject("CDO.Message")
	Set configMail = Server.CreateObject ("CDO.Configuration")

	oMail.Subject = sAsunto
	oMail.From = sDesde
	oMail.To = sDestinatario
	oMail.CC = sCC
	if html then
		oMail.HTMLBody = sCuerpo
	else
		oMail.TextBody = sCuerpo
	end if

    With configMail.Fields
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.office365.com"
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25  //587 doesn't work either)
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 90
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") ="user"
        .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="pass"
        .Update
	End With

    Set oMail.Configuration = configMail
	oMail.Send  // error (line 31)

	Set oMail = Nothing
    Set configMail = Nothing
End Function

Apparently the configuration is fine, but the reality is that it does not run, therefore I assume that the problem is not in the script, why I comment this, because this same script I tried on another
machine that has Windows 10 and it works without problem.

Thinking that maybe we should create some exit rule in Windows Firewall, enable ports 25 and 587 to see if this allowed me to send but it does not work either.

The truth is that I don’t know what else to do,… could someone help me to solve this problem.

I appreciate in advance your time and service

Cheers

Вопрос:

Это действительно только мой второй скрипт VBS, поэтому будьте осторожны… Я сделал что-то, что было лично или связано с компанией. Я уверен, что все эти поля в любом случае верны. SMTP-сервер правильный, я дважды проверил с провайдером, так как это причина номер 1, найденная на других сайтах. Этот скрипт также будет извлекать информацию из определенной ячейки и вставлять ее в тело… Любая помощь будет принята с благодарностью! Также он говорит, что ошибка находится в строке 46, которая является “ObjSendMail.Send”. Все работает, кроме части электронной почты…

    Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message")
Set objExcel = CreateObject("Excel.Application")
StopDate = DateAdd("d", -1 - Weekday(Date), Date)
StartDate = StopDate-13

Dim xlApp
Dim xlWkb
Dim monthEnd
Set xlApp = CreateObject("excel.application")

Set xlWkb = xlApp.Workbooks.Open("******")
xlWkb.RunAutoMacros 1
xlApp.Run ("UpdateAll")
monthEnd = xlApp.cells(2,7).value
xlApp.ActiveWorkbook.SaveAs strSaveFile & "Monthly Revenue Report " & Year(Now) & "." & Month(Now) & "." & Day(Now) & ".xls", 56

xlApp.Quit
Set xlWkb = Nothing
Set xlApp = Nothing

WScript.Sleep 10000
mailSubject = "Monhtly Revenue Report " & PrevMonthName
mailBody = "The Monthly Revenue Report is no ready. Month End: " & monthEnd

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") = 25
ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
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") = "********"
ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "********"
ObjSendMail.Configuration.Fields.Update

ObjSendMail.To = "*********"
ObjSendMail.Subject = mailSubject
ObjSendMail.From = "*******"
'ObjSendMail.HTMLBody = "this is the body"
ObjSendMail.TextBody = mailBody
ObjSendMail.Send


'Set ObjSendMail = Nothing

Лучший ответ:

В случае сомнений прочитайте документацию. Office365 использует порт представления (587/tcp) для отправки почты. Замените это:

ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

с этим:

ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587

и ошибка должна исчезнуть (при условии, что исходящие подключения к порту 587/tcp разрешены в вашей сети).

Вы можете проверить доступность порта с помощью сканера портов, такого как nmap, scanline или PortQry) или вручную с помощью telnet:

telnet smtp.office365.com 587

Исходные соединения с портом 25/tcp скорее всего блокируются вашим провайдером в качестве меры для предотвращения/уменьшения спама ботнета.

Ответ №1

Следующий код работал для smtp.office365.com. Вы указываете smtpusessl = true, но вы НЕ указываете порт, иначе вы получите ошибку 5.7.57.

    Sub SMPTTest2()
Set emailObj = CreateObject("CDO.Message")

emailObj.From = "name@myaddress.com"
emailObj.To = "name@youraddress.com"
emailObj.Subject = "Test CDO"
emailObj.TextBody = "Test CDO"
'emailObj.AddAttachment "c:windowswin.ini"

Set emailConfig = emailObj.Configuration


emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.office365.com"
'Exclude the following line
'emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "name@myaddress.com"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypassword"
emailConfig.Fields.Update

emailObj.Send

If Err.Number = 0 Then MsgBox "Done"
End Sub

Ответ №2

  • Cdb9 код ошибки бмв
  • Cdimport ert 1851 ошибка исполнения метода
  • Ce 3005 8 ps4 ошибка
  • Cdf9 ошибка бмв е70
  • Cda904 ошибка bmw f30