The transport failed to connect to the server error - email

Set emailObj = CreateObject("CDO.Message")
emailObj.Sender = "zzz#xxx.com"
emailObj.To = "xxx#xxx.com"
emailObj.Subject = "Test CDO"
emailObj.TextBody = "Test CDO"
Set emailConfig = emailObj.Configuration
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.live.com"
emailConfig.Fields("----/smtpserverport") = 465
emailConfig.Fields("----/sendusing") = 2
emailConfig.Fields("----/smtpauthenticate") = 1
emailConfig.Fields("----/smtpusessl") = true
emailConfig.Fields("----/sendusername") = "xxxx#gmail.com"
emailConfig.Fields("----/sendpassword") = "*****"
emailConfig.Fields.Update
emailObj.Send
If Err.Number = 0 Then
MsgBox "Done"
End If
If Err.Number <> 0 Then
MsgBox "Can't Proceed"
End If
It's a code to send email via live.com, but I am getting "The transport failed to connect to the server" error. Can anyone help me out in resolving this error?

mail.live.com is just a webserver(farm):
xxx#iridium:~ $ nmap mail.live.com
Starting Nmap 6.47 ( http://nmap.org ) at 2016-03-31 08:53 CEST
Nmap scan report for mail.live.com (157.56.198.204)
Host is up (0.029s latency).
Other addresses for mail.live.com (not scanned): 157.55.230.252
rDNS record for 157.56.198.204: origin.du130w.dub130.mail.live.com
Not shown: 965 closed ports, 33 filtered ports
PORT STATE SERVICE
80/tcp open http
443/tcp open https
Nmap done: 1 IP address (1 host up) scanned in 8.32 seconds
For mail submission to outlook.com use smtp-mail.outlook.com and port 25 or 587 (see here).
Not sure if you can use a Gmail address to authenticate to Microsoft's mail service, though.

Related

Plesk send Email TLS not available

Mail from Plesk.
But i recieve this answer
Out: 220 **DOMAIN** ESMTP Postfix (Debian/GNU)
In:  EHLO [10.33.205.183]
Out: 250-**DOMAIN**
Out: 250-PIPELINING
Out: 250-SIZE 31457280
Out: 250-ETRN
Out: 250-STARTTLS
Out: 250-AUTH DIGEST-MD5 CRAM-MD5 PLAIN LOGIN
Out: 250-ENHANCEDSTATUSCODES
Out: 250-8BITMIME
Out: 250 DSN
In:  STARTTLS
Out: 454 4.7.0 TLS not available due to local problem
In:  ???
Out: 502 5.5.2 Error: command not recognized
In:  ?????(?'??????
Out: 502 5.5.2 Error: command not recognized
In:  ????
Out: 502 5.5.2 Error: command not recognized
Out: 421 4.4.2 **DOMAIN** Error: timeout exceeded
Session aborted, reason: timeout
For other details, see the local mail logfile
Here is my main.cf:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# TLS parameters
smtpd_tls_cert_file = /etc/postfix/tls/httpsd.pem
smtpd_tls_key_file = $smtpd_tls_cert_file
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = ***DOMAIN***
alias_maps = hash:/etc/aliases, hash:/var/spool/postfix/plesk/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = localhost.startdedicated.de, localhost, localhost.localdomain
relayhost =
mynetworks = 127.0.0.0/8 [::1]/128 **IP**/32
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
virtual_mailbox_domains = $virtual_mailbox_maps, hash:/var/spool/postfix/plesk/virtual_domains
virtual_alias_maps = $virtual_maps, hash:/var/spool/postfix/plesk/virtual
virtual_mailbox_maps = , hash:/var/spool/postfix/plesk/vmailbox
transport_maps = , hash:/var/spool/postfix/plesk/transport
smtpd_tls_security_level = may
smtp_tls_security_level = may
smtp_use_tls = no
smtpd_timeout = 3600s
smtpd_proxy_timeout = 3600s
disable_vrfy_command = yes
smtpd_sender_restrictions = check_sender_access hash:/var/spool/postfix/plesk/blacklists, permit_sasl_authenticated
smtpd_client_restrictions = permit_mynetworks, permit_sasl_authenticated
smtp_send_xforward_command = yes
smtpd_authorized_xforward_hosts = 127.0.0.0/8 [::1]/128
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
virtual_mailbox_base = /var/qmail/mailnames
virtual_uid_maps = static:30
virtual_gid_maps = static:31
smtpd_milters = , inet:127.0.0.1:12768
non_smtpd_milters =
sender_dependent_default_transport_maps = hash:/var/spool/postfix/plesk/sdd_transport_maps
virtual_transport = plesk_virtual
plesk_virtual_destination_recipient_limit = 1
mailman_destination_recipient_limit = 1
virtual_mailbox_limit = 0
message_size_limit = 31457280
I should say, that i not be an expert on linux and mailing!
The config file is located: /etc/postfix/main.cf
The cert /etc/postfix/tls/httpsd.pem is the servers default cert.
Thank you!
TL;TR: both bad client and bad server.
The mail server you use is configured wrong in that it believes it can to TLS (as seen in EHLO containing STARTTLS) but then fails to actually use TLS (error when client tries to use TLS). Additionally the client simply ignores the error message to the STARTTLS command and continues with the TLS handshake. This causes error messages from the server which expects proper SMTP commands but instead gets what looks like garbage (the TLS ClientHello).

Sneding SMTP Mail with Office365 from SQL2000 DTS

we have migrated from a shared Exchange email host to Office 365. We have some old SQL2000 DTS Active X scripts (vbscript) sending mail that have quit working now. We are sending using CDO and connecting with SMTP. I don't believe anything on the server or our network have changed, but not 100% sure. Below is the vbscript. We are getting a "transport failed to connect to the server" error on the .Send line. Any ideas on how to fix this?
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
'# Get a preconfigured "CDO.Message" object
Set oMail = GetCdoMessageObject()
'# Send email
With oMail
.From = "mailsend#ourdomain.com"
.To = "me#ourdomain.com"
.Subject = "test to cfoster#ourdomain.coml"
.TextBody = "This message was sent from a DTS package."
.HtmlBody = "<div><p>This <i>message</i> was sent from a <b>DTS</b> package.</p></div>"
.Send
End With
'# Clean Up
Set oMail = Nothing
'# Return
Main = DTSTaskExecResult_Success
End Function
Function GetCdoMessageObject()
Dim CdoMessage
Set CdoMessage = CreateObject("CDO.Message")
CdoMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'CdoSendUsingPort
CdoMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="smtp.office365.com"
CdoMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
CdoMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True 'Use SSL for the connection (True or False)
CdoMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
CdoMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'cdoBasic
CdoMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="mailsend#ourdomain.com"
CdoMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="passwordhere"
CdoMessage.Configuration.Fields.Update
Set GetCdoMessageObject = CdoMessage
End Function
I found that if I specified SSL true then I had to comment out the line specifying port 587.

postfix and external smtp server - lost connection while sending MAIL FROM

i'm trying to configure postfix to work with an external smtp server.
This is my main.cf file (this is from a fresh installation and few customize settings):
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = ubuntuTesting
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = ubuntuTesting, localhost.localdomain, localhost
relayhost = smtp.site.it
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = smtpd
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_type = cyrus
smtp_sasl_auth_enable = yes
# optional: necessary if email provider uses load balancing and
# forwards emails to another smtp server
# for delivery (ie: smtp.yahoo.com --> smtp.phx.1.yahoo.com)
smtp_cname_overrides_servername = no
I've created the sasl_passwd with smtp, username and password. When i try to send an email with 'mail' command this is the output in the logs
Jun 12 15:13:13 ubuntuTesting postfix/qmgr[2390]: AE6FD1E136B: from=<ubuntu#ubuntuTesting>, size=368, nrcpt=1 (queue active)
Jun 12 15:13:14 ubuntuTesting postfix/smtp[2401]: AE6FD1E136B: enabling PIX workarounds: disable_esmtp delay_dotcrlf for smtp.site.com[xxx.xxx.xx.xx]:25
Jun 12 15:13:14 ubuntuTesting postfix/smtp[2401]: AE6FD1E136B: to=<stefano#site.com>, relay=smtp.site.com[xxx.xxx.xx.xx]:25, delay=0.72, delays=0.04/0.04/0.59/0.05, dsn=4.4.2, status=deferred (lost connection with smtp.site.com[xxx.xxx.xx.xx] while sending MAIL FROM)
Jun 12 15:23:03 ubuntuTesting postfix/smtp[2491]: AE6FD1E136B: enabling PIX workarounds: disable_esmtp delay_dotcrlf for smtp.site.com[xxx.xxx.xx.xx]:25
Jun 12 15:23:03 ubuntuTesting postfix/smtp[2491]: AE6FD1E136B: to=<stefano#site.com>, relay=smtp.site.com[xxx.xxx.xx.xx]:25, delay=590, delays=589/0.01/0.36/0.04, dsn=4.4.2, status=deferred (lost connection with smtp.site.com[xxx.xxx.xx.xx] while sending MAIL FROM)
I think the issues is that the smtp server accept AUTH PLAIN login type, but i can't figure out how to login correctly. I've tried a lot of things.
I can make it works with my google account, but not with this one.

Text Emailing using VBscript

I have tried the following code, No errors thrown. and no emails have been sent either.
Dim i, objEmail
' Use custom error handling
On Error Resume Next
Set objEmail = CreateObject( "CDO.Message" )
' Fill in the field values
With objEmail
.From = "xyz#abc.com"
.To = "pqr#abc.com"
.Subject = "Test"
.TextBody = "Email from VB Script"
If mySMTPPort = "" Then
mySMTPPort = 25
End If
With .Configuration.Fields
.Item( "http://schemas.microsoft.com/cdo/configuration/sendusing" ) = 2
.Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ) = "HostNameHere"
.Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ) = 25
.Update
End With
.Send
End With
' Return status message
If Err Then
EMail = "ERROR " & Err.Number & ": " & Err.Description
Err.Clear
Else
EMail = "Message sent ok"
End If
' Release the e-mail message object
Set objEmail = Nothing
When I execute this VBS file, It just does nothing at all. Please help me out. I have to send simple text emails from my domain to another domain. Or is there a work around for the task i want to perform?
You're probably getting an error when trying to send mail. However, you have error handling enabled (On Error Resume Next), but your error handler just puts the error information in a variable without actually doing anything with that variable. Adding a line that echoes the variable should provide you with more information about what's going on:
If Err Then
EMail = "ERROR " & Err.Number & ": " & Err.Description
Err.Clear
Else
EMail = "Message sent ok"
End If
WScript.Echo EMail
should provide you with more information about what's going on.
Edit: Apparently you're getting a connection error. There are several possible causes for that. First check that your name resolution works correctly:
nslookup HostNameHere
If the name doesn't resolve either use the IP address in your script or get the name resolution fixed.
Next check if you can connect to port 25 on the remote host, both via name and IP address:
telnet HostNameHere 25
telnet a.b.c.d 25
If you get a result like this:
C:\>telnet HostNameHere 25
Connecting To HostNameHere...Could not open connection to the host, on port 25:
Connect failed
something is blocking your connection. Could be a network firewall, a host-based firewall on the remote host, or the service not listening on port 25 in the first place. Check with your network admins and/or the admin(s) of the mail server.
Your code hides errors. err default property is number. So You say if err.number = 0 (same as false) then error, if err.number not 0 (ie error) everything fine.

Send email using CDO no longer working

since last week, I am no longer able to send email via gmail's smtp server. I get the error " -2147220973 the transport failed to connect to the server" whenever I try to send email. However, if I try using my another network (ex. my mobile broadband) it works.
Below is my code for sending email.
Set cdomsg = CreateObject("CDO.Message")
Set cdoconf = CreateObject("CDO.Configuration")
cdoconf.Load -1 ' CDO Source Defaults
Set cdoFields = cdoconf.Fields
With cdoFields
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "example#gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "abc"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smptserverport") = 465
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Update
End With
What is the possible problem? Thank you.