PHPMailer SMTP Error: Could not connect to SMTP host - email

Having a strange problem with PHPMailer where it's showing an SMTP connection error, as seen below. What could cause this? It works when I use the Gmail SMTP server, and also works with the local mail function. Roundcube on the server sends fine. It just seems to be PHPMailer. All settings are correct, to the best of my knowledge. It's using TLS and I've tried different ports. The correct ports show the following error:
2016-05-05 21:58:47 Connection: opening to mail.myserver.com:587, timeout=300, options=array (
)
2016-05-05 21:58:47 Connection: opened
2016-05-05 21:58:52 SMTP -> get_lines(): $data is ""
2016-05-05 21:58:52 SMTP -> get_lines(): $str is "220 sys.myserver.com ESMTP Exim 4.72 Thu, 05 May 2016 17:58:50 -0400
"
2016-05-05 21:58:52 SERVER -> CLIENT: 220 sys.myserver.com ESMTP Exim 4.72 Thu, 05 May 2016 17:58:50 -0400
2016-05-05 21:58:52 CLIENT -> SERVER: EHLO localhost
2016-05-05 21:58:52 SMTP -> get_lines(): $data is ""
2016-05-05 21:58:52 SMTP -> get_lines(): $str is "250-sys.myserver.com Hello ***********]
"
2016-05-05 21:58:52 SMTP -> get_lines(): $data is "250-sys.myserver.com Hello cpc68331-cdif16-2-0-cust906.5-1.cable.virginm.net [86.3.207.139]
"
2016-05-05 21:58:52 SMTP -> get_lines(): $str is "250-SIZE 52428800
"
2016-05-05 21:58:52 SMTP -> get_lines(): $data is "250-sys.myserver.com Hello cpc68331-cdif16-2-0-cust906.5-1.cable.virginm.net [86.3.207.139]
250-SIZE 52428800
"
2016-05-05 21:58:52 SMTP -> get_lines(): $str is "250-PIPELINING
"
2016-05-05 21:58:52 SMTP -> get_lines(): $data is "250-sys.myserver.com Hello ***************************]
250-SIZE 52428800
250-PIPELINING
"
2016-05-05 21:58:52 SMTP -> get_lines(): $str is "250-AUTH PLAIN LOGIN
"
2016-05-05 21:58:52 SMTP -> get_lines(): $data is "250-sys.myserver.com Hello ****************************]
250-SIZE 52428800
250-PIPELINING
250-AUTH PLAIN LOGIN
"
2016-05-05 21:58:52 SMTP -> get_lines(): $str is "250-STARTTLS
"
2016-05-05 21:58:52 SMTP -> get_lines(): $data is "250-sys.myserver.com Hello ******************]
250-SIZE 52428800
250-PIPELINING
250-AUTH PLAIN LOGIN
250-STARTTLS
"
2016-05-05 21:58:52 SMTP -> get_lines(): $str is "250 HELP
"
2016-05-05 21:58:52 SERVER -> CLIENT: 250-sys.myserver.com Hello ***************]
250-SIZE 52428800
250-PIPELINING
250-AUTH PLAIN LOGIN
250-STARTTLS
250 HELP
2016-05-05 21:58:52 CLIENT -> SERVER: STARTTLS
2016-05-05 21:58:52 SMTP -> get_lines(): $data is ""
2016-05-05 21:58:52 SMTP -> get_lines(): $str is "220 TLS go ahead
"
2016-05-05 21:58:52 SERVER -> CLIENT: 220 TLS go ahead
2016-05-05 21:58:52 SMTP Error: Could not connect to SMTP host.
2016-05-05 21:58:52 CLIENT -> SERVER: QUIT
2016-05-05 21:58:53 SMTP -> get_lines(): $data is ""
2016-05-05 21:58:53 SMTP -> get_lines(): $str is "����221 sys.myserver.com closing connection
"
2016-05-05 21:58:53 SMTP -> get_lines(): $data is "����221 sys.myserver.com closing connection
"
2016-05-05 21:58:53 SMTP -> get_lines(): $str is ""
2016-05-05 21:58:53 SERVER -> CLIENT: ����221 sys.myserver.com closing connection
2016-05-05 21:58:53 SMTP ERROR: QUIT command failed: ����221 sys.myserver.com closing connection
----------
2016-05-05 21:58:53 Connection: closed
2016-05-05 21:58:53 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
{"success":1,"id":"3391"}

This is covered in the troubleshooting guide. It's failing immediately after STARTTLS, which usually indicates that your mail server is publishing an invalid SSL certificate, either expired, self-signed or doesn't match the host name. The real solution is to fix the cert, but the guide tells you how you can disable verification.
Presumably gmail is working because it doesn't have a broken SSL config, and roundcube is probably submitting to localhost without TLS (via mail()), so it won't encounter the problem.

Related

Sendmail use localhost.localdomain

Sendmail with Perl uses localhost.localdomain instead of a fully qualified domain name (FQDN). Sendmail and server configuration is correct, hostname is setup with FQDN.
My script contains the following lines:
use MIME::Lite;
use Email::Sender::Simple qw /sendmail/;
use Email::Sender::Transport::SMTPS;
...
my $transport = Email::Sender::Transport::SMTPS->new({
host => $server,
ssl => 'starttls',
port => $port,
sasl_username => $user,
sasl_password => $password,
debug => 1,
});
sendmail($msg->as_string, { transport => $transport });
Mail is sent successfully, however sendmail use localhost.localdomain instead of FQDN with EHLO. Debug information shows:
Net::SMTPS>>> Net::SMTPS(0.09)
Net::SMTPS>>> IO::Socket::IP(0.39)
Net::SMTPS>>> IO::Socket(1.40)
Net::SMTPS>>> IO::Handle(1.40)
Net::SMTPS>>> Exporter(5.73)
Net::SMTPS>>> Net::SMTP(3.11)
Net::SMTPS>>> Net::Cmd(3.11)
Net::SMTPS=GLOB(0x2903e48)<<< 220 smtp.gmail.com ESMTP l186sm18879092ioa.54 - gsmtp
Net::SMTPS=GLOB(0x2903e48)>>> EHLO localhost.localdomain
Net::SMTPS=GLOB(0x2903e48)<<< 250-smtp.gmail.com at your service, [masked IP address]
Net::SMTPS=GLOB(0x2903e48)<<< 250-SIZE 35882577
Net::SMTPS=GLOB(0x2903e48)<<< 250-8BITMIME
Net::SMTPS=GLOB(0x2903e48)<<< 250-STARTTLS
Net::SMTPS=GLOB(0x2903e48)<<< 250-ENHANCEDSTATUSCODES
Net::SMTPS=GLOB(0x2903e48)<<< 250-PIPELINING
Net::SMTPS=GLOB(0x2903e48)<<< 250-CHUNKING
Net::SMTPS=GLOB(0x2903e48)<<< 250 SMTPUTF8
Net::SMTPS=GLOB(0x2903e48)>>> STARTTLS
Net::SMTPS=GLOB(0x2903e48)<<< 220 2.0.0 Ready to start TLS
Net::SMTPS=GLOB(0x2903e48)>>> EHLO localhost.localdomain
Net::SMTPS=GLOB(0x2903e48)<<< 250-smtp.gmail.com at your service, [masked IP address]
Net::SMTPS=GLOB(0x2903e48)<<< 250-SIZE 35882577
Net::SMTPS=GLOB(0x2903e48)<<< 250-8BITMIME
Net::SMTPS=GLOB(0x2903e48)<<< 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
Net::SMTPS=GLOB(0x2903e48)<<< 250-ENHANCEDSTATUSCODES
Net::SMTPS=GLOB(0x2903e48)<<< 250-PIPELINING
Net::SMTPS=GLOB(0x2903e48)<<< 250-CHUNKING
Net::SMTPS=GLOB(0x2903e48)<<< 250 SMTPUTF8
When sendmail is used from the console directly (not using Perl), correct FQDN is used with EHLO.
Net::SMTPS=GLOB(0x2903e48)>>> EHLO localhost.localdomain
From the documentation of Email::Sender::Transport::SMTPS:
ATTRIBUTES
The following attributes may be passed to the constructor:
...
helo: what to say when saying HELO; no default
If nothing is given in helo the default from the underlying packet (Net::SMTPS) is used, which is localhost.localdomain. To use something different just do
my $transport = Email::Sender::Transport::SMTPS->new({
...,
helo => 'whatever.you.want.to.use.instead.of.localhost.localdomain'
});

SMTP relay not working on PHPMailer 6.0.5

I'm using PHPMailer to send email via SMTP relay from my platform to send email. I've configured the authentication and everything, and also successfully sent test emails from the command line mail program on my server.
Initially, I had configured the SMTP relay via Postfix config and aimed to use the PHP mail() function. This was working fine from basic test scripts, but from my platform software, the emails were disappearing, despite the Postfix log saying the mail was relayed out successfully.
I replaced the usage of the mail() function with the latest version of PHPMailer, however the issue persists. I have captured a full log of a test send as an example:
2018-05-11 00:32:42 Connection: opening to smtp.api.createsend.com:587, timeout=300, options=array()
2018-05-11 00:32:43 Connection: opened
2018-05-11 00:32:43 SMTP INBOUND: "220 smtp.api.createsend.com ESMTP"
2018-05-11 00:32:43 SERVER -> CLIENT: 220 smtp.api.createsend.com ESMTP
2018-05-11 00:32:43 CLIENT -> SERVER: EHLO localhost
2018-05-11 00:32:43 SMTP INBOUND: "250-Hello smtp.api.createsend.com[1.129.185.25]"
2018-05-11 00:32:43 SMTP INBOUND: "250-PIPELINING"
2018-05-11 00:32:43 SMTP INBOUND: "250-ENHANCEDSTATUSCODES"
2018-05-11 00:32:43 SMTP INBOUND: "250-8BITMIME"
2018-05-11 00:32:43 SMTP INBOUND: "250-STARTTLS"
2018-05-11 00:32:43 SMTP INBOUND: "250-AUTH PLAIN LOGIN"
2018-05-11 00:32:43 SMTP INBOUND: "250-AUTH=PLAIN LOGIN"
2018-05-11 00:32:43 SMTP INBOUND: "250 SIZE 20971520"
2018-05-11 00:32:43 SERVER -> CLIENT: 250-Hello smtp.api.createsend.com[1.129.185.25]250-PIPELINING250-ENHANCEDSTATUSCODES250-8BITMIME250-STARTTLS250-AUTH PLAIN LOGIN250-AUTH=PLAIN LOGIN250 SIZE 20971520
2018-05-11 00:32:43 CLIENT -> SERVER: STARTTLS
2018-05-11 00:32:43 SMTP INBOUND: "220 2.0.0 Ready to start TLS"
2018-05-11 00:32:43 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
2018-05-11 00:32:43 CLIENT -> SERVER: EHLO localhost
2018-05-11 00:32:43 SMTP INBOUND: "250-Hello smtp.api.createsend.com[1.129.185.25]"
2018-05-11 00:32:43 SMTP INBOUND: "250-PIPELINING"
2018-05-11 00:32:43 SMTP INBOUND: "250-ENHANCEDSTATUSCODES"
2018-05-11 00:32:43 SMTP INBOUND: "250-8BITMIME"
2018-05-11 00:32:43 SMTP INBOUND: "250-AUTH PLAIN LOGIN"
2018-05-11 00:32:43 SMTP INBOUND: "250-AUTH=PLAIN LOGIN"
2018-05-11 00:32:43 SMTP INBOUND: "250 SIZE 20971520"
2018-05-11 00:32:43 SERVER -> CLIENT: 250-Hello smtp.api.createsend.com[1.129.185.25]250-PIPELINING250-ENHANCEDSTATUSCODES250-8BITMIME250-AUTH PLAIN LOGIN250-AUTH=PLAIN LOGIN250 SIZE 20971520
2018-05-11 00:32:43 Auth method requested: UNSPECIFIED
2018-05-11 00:32:43 Auth methods available on the server: PLAIN,LOGIN
2018-05-11 00:32:43 Requested auth method not available:
2018-05-11 00:32:43 Auth method selected: LOGIN
2018-05-11 00:32:43 CLIENT -> SERVER: AUTH LOGIN
<snip>
2018-05-11 00:32:43 SMTP INBOUND: "235 2.7.0 Authentication successful"
2018-05-11 00:32:43 SERVER -> CLIENT: 235 2.7.0 Authentication successful
2018-05-11 00:32:43 CLIENT -> SERVER: MAIL FROM:<###envelope_from_email_address#domain1###>
2018-05-11 00:32:43 SMTP INBOUND: "250 2.1.0 accepting mail from <###envelope_from_email_address#domain1###> OK"
2018-05-11 00:32:43 SERVER -> CLIENT: 250 2.1.0 accepting mail from <###envelope_from_email_address#domain1###> OK
2018-05-11 00:32:43 CLIENT -> SERVER: RCPT TO:<###to_email_address#domain2###>
2018-05-11 00:32:43 SMTP INBOUND: "250 2.1.0 I'll make sure <###to_email_address#domain2###> gets this"
2018-05-11 00:32:43 SERVER -> CLIENT: 250 2.1.0 I'll make sure <###to_email_address#domain2###> gets this
2018-05-11 00:32:43 CLIENT -> SERVER: DATA
2018-05-11 00:32:43 SMTP INBOUND: "354 2.0.0 Go ahead. End your data with <CR><LF>.<CR><LF>"
2018-05-11 00:32:43 SERVER -> CLIENT: 354 2.0.0 Go ahead. End your data with <CR><LF>.<CR><LF>
2018-05-11 00:32:43 CLIENT -> SERVER: Date: Fri, 11 May 2018 10:32:42 +1000
2018-05-11 00:32:43 CLIENT -> SERVER: To: ###to_email_address#domain2###
2018-05-11 00:32:43 CLIENT -> SERVER: From: ###from_email_address#domain3###
2018-05-11 00:32:43 CLIENT -> SERVER: Subject: ###email_subject###
2018-05-11 00:32:43 CLIENT -> SERVER: Message-ID: <0JtQSmGxTN2PuNR4zJx5iqS9FyZrLK5gL3zPLHwVCA#localhost>
2018-05-11 00:32:43 CLIENT -> SERVER: X-Mailer: PHPMailer 6.0.5 (https://github.com/PHPMailer/PHPMailer)
2018-05-11 00:32:43 CLIENT -> SERVER: MIME-Version: 1.0
2018-05-11 00:32:43 CLIENT -> SERVER: Content-Type: multipart/alternative;
2018-05-11 00:32:43 CLIENT -> SERVER: boundary="b1_0JtQSmGxTN2PuNR4zJx5iqS9FyZrLK5gL3zPLHwVCA"
2018-05-11 00:32:43 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
2018-05-11 00:32:43 CLIENT -> SERVER:
2018-05-11 00:32:43 CLIENT -> SERVER: This is a multi-part message in MIME format.
2018-05-11 00:32:43 CLIENT -> SERVER: --b1_0JtQSmGxTN2PuNR4zJx5iqS9FyZrLK5gL3zPLHwVCA
2018-05-11 00:32:43 CLIENT -> SERVER: Content-Type: text/plain; charset=us-ascii
2018-05-11 00:32:43 CLIENT -> SERVER:
2018-05-11 00:32:43 CLIENT -> SERVER:
<snip for plaintext email content>
2018-05-11 00:32:43 CLIENT -> SERVER:
2018-05-11 00:32:43 CLIENT -> SERVER: --b1_0JtQSmGxTN2PuNR4zJx5iqS9FyZrLK5gL3zPLHwVCA
2018-05-11 00:32:43 CLIENT -> SERVER: Content-Type: text/html; charset=us-ascii
2018-05-11 00:32:43 CLIENT -> SERVER:
<snip for html email content>
2018-05-11 00:32:43 CLIENT -> SERVER:
2018-05-11 00:32:43 CLIENT -> SERVER:
2018-05-11 00:32:43 CLIENT -> SERVER: --b1_0JtQSmGxTN2PuNR4zJx5iqS9FyZrLK5gL3zPLHwVCA--
2018-05-11 00:32:43 CLIENT -> SERVER:
2018-05-11 00:32:43 CLIENT -> SERVER: .
2018-05-11 00:32:43 SMTP INBOUND: "250 2.0.0 OK:ODJmM2I5YmEtMzU0My00M2ZjLWE5NzUtNTlkNzNkMjE0N2Ew"
2018-05-11 00:32:43 SERVER -> CLIENT: 250 2.0.0 OK:ODJmM2I5YmEtMzU0My00M2ZjLWE5NzUtNTlkNzNkMjE0N2Ew
2018-05-11 00:32:43 CLIENT -> SERVER: QUIT
2018-05-11 00:32:43 SMTP INBOUND: "221 2.0.0 Bye"
2018-05-11 00:32:43 SERVER -> CLIENT: 221 2.0.0 Bye
2018-05-11 00:32:43 Connection: closed
As it shows, PHPMailer successfully connects and authenticates using TLS, sends the email content, signs off without a hitch. However, this (and many other similar examples) don't appear in the SMTP provider's delivery logs. Additionally, I've been told by their customer support that these emails are never hitting their servers. Example response (this response was based on the above log):
Thank you for following up here, I'm afraid we don't have detailed enough logs to provide further information on this. Also, I can't see from the information you provided that we are responding with a message ID, I believe the message ID that appears in your log is generated by PHP Mailer and is not related to Campaign Monitor. I don't believe our server is responding to this attempt to send an email, which would indicate that the problem is with your implementation of PHP Mailer.
As the provider says, the issue here is with PHP Mailer. That doesn't make sense at all to me based on the logs, but I don't know enough to be able to diagnose what's going wrong and why these emails are disappearing. How can I troubleshoot the problem?
This delivery is entirely successful. Any issues after that are not down to your sending code. To find out what happened to the message, you would need to look at the mail logs on smtp.api.createsend.com (which is apparently Campaign Monitor).
PHPMailer creates the Message-ID header, as it should, since it's the responsibility of the MUA, in this case 0JtQSmGxTN2PuNR4zJx5iqS9FyZrLK5gL3zPLHwVCA#localhost, and you could improve this. It's falling back to localhost as the hostname, which suggests PHP on your server is not configured correctly and doesn't know its own hostname. You can either fix that in your PHP config, or set $mail->MessageID yourself (note the pattern that it must match).
The SMTP transaction ID (in this case ODJmM2I5YmEtMzU0My00M2ZjLWE5NzUtNTlkNzNkMjE0N2Ew), which is not the same as the message ID, is created by the receiving server and is usually used for internal tracking by the receiving server.
Incidentally it's the first time I've seen Campaign Monitor's transaction ID pattern, and it's different to others, so I've added it to PHPMailer. You will be able to retrieve it after sending by calling $mail->smtp->getLastTransactionID().

Can't send email via SMTP office365 with PHPMailer (Full logs)

I am getting the error: Auth method requested UNKNOWN, when trying to send emails via smtp with smtp.office365.com.
Using the same password and username on https://smtp.office365.com/owa/ website successfully logs me into the account.
I have confirmed the username and password are correct.
PhpMailer v6 used ..Code is here https://pastebin.com/vteFTsCM
Kindly assist..
Below are the full error logs.
2017-09-25 08:22:48 Connection: opening to smtp.office365.com:587, timeout=300, options=array()
2017-09-25 08:22:48 Connection: opened
2017-09-25 08:22:49 SMTP INBOUND: "220 DB6PR0601CA0011.outlook.office365.com Microsoft ESMTP MAIL Service ready at Mon, 25 Sep 2017 08:22:48 +0000"
2017-09-25 08:22:49 SERVER -> CLIENT: 220 DB6PR0601CA0011.outlook.office365.com Microsoft ESMTP MAIL Service ready at Mon, 25 Sep 2017 08:22:48 +0000
2017-09-25 08:22:49 CLIENT -> SERVER: EHLO localhost
2017-09-25 08:22:49 SMTP INBOUND: "250-DB6PR0601CA0011.outlook.office365.com Hello [197.254.27.214]"
2017-09-25 08:22:49 SMTP INBOUND: "250-SIZE 157286400"
2017-09-25 08:22:49 SMTP INBOUND: "250-PIPELINING"
2017-09-25 08:22:49 SMTP INBOUND: "250-DSN"
2017-09-25 08:22:49 SMTP INBOUND: "250-ENHANCEDSTATUSCODES"
2017-09-25 08:22:49 SMTP INBOUND: "250-STARTTLS"
2017-09-25 08:22:49 SMTP INBOUND: "250-8BITMIME"
2017-09-25 08:22:49 SMTP INBOUND: "250-BINARYMIME"
2017-09-25 08:22:49 SMTP INBOUND: "250-CHUNKING"
2017-09-25 08:22:49 SMTP INBOUND: "250 SMTPUTF8"
2017-09-25 08:22:49 SERVER -> CLIENT: 250-DB6PR0601CA0011.outlook.office365.com Hello [197.254.27.214]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-STARTTLS250-8BITMIME250-BINARYMIME250-CHUNKING250 SMTPUTF8
2017-09-25 08:22:49 CLIENT -> SERVER: STARTTLS
2017-09-25 08:22:49 SMTP INBOUND: "220 2.0.0 SMTP server ready"
2017-09-25 08:22:49 SERVER -> CLIENT: 220 2.0.0 SMTP server ready
2017-09-25 08:22:50 CLIENT -> SERVER: EHLO localhost
2017-09-25 08:22:50 SMTP INBOUND: "250-DB6PR0601CA0011.outlook.office365.com Hello [197.254.27.214]"
2017-09-25 08:22:50 SMTP INBOUND: "250-SIZE 157286400"
2017-09-25 08:22:50 SMTP INBOUND: "250-PIPELINING"
2017-09-25 08:22:50 SMTP INBOUND: "250-DSN"
2017-09-25 08:22:50 SMTP INBOUND: "250-ENHANCEDSTATUSCODES"
2017-09-25 08:22:50 SMTP INBOUND: "250-AUTH LOGIN XOAUTH2"
2017-09-25 08:22:50 SMTP INBOUND: "250-8BITMIME"
2017-09-25 08:22:50 SMTP INBOUND: "250-BINARYMIME"
2017-09-25 08:22:50 SMTP INBOUND: "250-CHUNKING"
2017-09-25 08:22:50 SMTP INBOUND: "250 SMTPUTF8"
2017-09-25 08:22:50 SERVER -> CLIENT: 250-DB6PR0601CA0011.outlook.office365.com Hello [197.254.27.214]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-AUTH LOGIN XOAUTH2250-8BITMIME250-BINARYMIME250-CHUNKING250 SMTPUTF8
2017-09-25 08:22:50 Auth method requested: UNKNOWN
2017-09-25 08:22:50 Auth methods available on the server: LOGIN,XOAUTH2
2017-09-25 08:22:50 Requested auth method not available:
2017-09-25 08:22:50 Auth method selected: LOGIN
2017-09-25 08:22:50 CLIENT -> SERVER: AUTH LOGIN
2017-09-25 08:22:50 SMTP INBOUND: "334 XXXXXXXXXXXXXXXXXXXXXXXXX"
2017-09-25 08:22:50 SERVER -> CLIENT: 334 XXXXXXXXXXXXXXXXXXXXXXXXX
2017-09-25 08:22:50 CLIENT -> SERVER: XXXXXXXXXXXXXXXXXXXXXXXXX==
2017-09-25 08:22:51 SMTP INBOUND: "334 XXXXXXXXXXXXXXXXXXXXXXXXX"
2017-09-25 08:22:51 SERVER -> CLIENT: 334 XXXXXXXXXXXXXXXXXXXXXXXXX
2017-09-25 08:22:51 CLIENT -> SERVER: XXXXXXXXXXXXXXXXXXXXXXXXX==
2017-09-25 08:22:58 SMTP INBOUND: "535 5.7.3 Authentication unsuccessful [DB6PR0601CA0011.eurprd06.prod.outlook.com]"
2017-09-25 08:22:58 SERVER -> CLIENT: 535 5.7.3 Authentication unsuccessful [DB6PR0601CA0011.eurprd06.prod.outlook.com]
2017-09-25 08:22:58 SMTP ERROR: Password command failed: 535 5.7.3 Authentication unsuccessful [DB6PR0601CA0011.eurprd06.prod.outlook.com]
SMTP Error: Could not authenticate.
2017-09-25 08:22:58 CLIENT -> SERVER: QUIT
2017-09-25 08:22:58 SMTP INBOUND: "221 2.0.0 Service closing transmission channel"
2017-09-25 08:22:58 SERVER -> CLIENT: 221 2.0.0 Service closing transmission channel
2017-09-25 08:22:58 Connection: closed
SMTP Error: Could not authenticate.
Message could not be sent.Mailer Error: SMTP Error: Could not authenticate.

using external smtp on my host using PHPMailer

I've searched every where for a solution for this problem, and I found many tips, but without success. I'm using PHPMailer to use external smtp (gmail or sendpulse). I've tried all possible ports, ideas, ... this is the code that I use:
$<?php
date_default_timezone_set('Etc/UTC');
require '../PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 6;
$mail->Debugoutput = 'html';
$mail->Host = "smtp.gmail.com";
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls";
$mail->Username = "sender#gmail.com";
$mail->Password = "password";
$mail->setFrom('sender#gmail.com', 'fsender lsender');
$mail->addAddress('receiver#gmail.com', 'freceiver lreceiver');
$mail->Subject = 'PHPMailer SMTP test';
$mail->msgHTML(file_get_contents('mail.txt'), dirname(__FILE__));
$mail->AltBody = 'This is a plain-text message body';
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
Debug:
Connection: opening to smtp.gmail.com:587, timeout=300, options=array ()<br>
Connection: opened<br>
SMTP -> get_lines(): $data is ""<br>
SMTP -> get_lines(): $str is "220-myaccount.arvixeshared.com ESMTP Exim 4.87 #1 Sun, 19 Mar 2017 00:57:26 -0400 "<br>
SMTP -> get_lines(): $data is "220-myaccount.arvixeshared.com ESMTP Exim 4.87 #1 Sun, 19 Mar 2017 00:57:26 -0400 "<br>
SMTP -> get_lines(): $str is "220-We do not authorize the use of this system to transport unsolicited, "<br>
SMTP -> get_lines(): $data is "220-myaccount.arvixeshared.com ESMTP Exim 4.87 #1 Sun, 19 Mar 2017 00:57:26 -0400 220-We do not authorize the use of this system to transport unsolicited, "<br>
SMTP -> get_lines(): $str is "220 and/or bulk e-mail."<br>
SERVER -> CLIENT: 220-myaccount.arvixeshared.com ESMTP Exim 4.87 #1 Sun, 19 Mar 2017 00:57:26 -0400 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.<br>
CLIENT -> SERVER: EHLO myaccount.arvixeshared.com<br>
SMTP -> get_lines(): $data is ""<br>
SMTP -> get_lines(): $str is "250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [xx.xx.xx.x]"<br>
SMTP -> get_lines(): $data is "250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [xx.xx.xx.x]"<br>
SMTP -> get_lines(): $str is "250-SIZE 52428800"<br>
SMTP -> get_lines(): $data is "250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [xx.xx.xx.x]250-SIZE 52428800"<br>
SMTP -> get_lines(): $str is "250-8BITMIME"<br>
SMTP -> get_lines(): $data is "250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [xx.xx.xx.x]250-SIZE 52428800250-8BITMIME"<br>
SMTP -> get_lines(): $str is "250-PIPELINING"<br>
SMTP -> get_lines(): $data is "250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [xx.xx.xx.x]250-SIZE 52428800250-8BITMIME250-PIPELINING"<br>
SMTP -> get_lines(): $str is "250-AUTH PLAIN LOGIN"<br>
SMTP -> get_lines(): $data is "250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [xx.xx.xx.x]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN"<br>
SMTP -> get_lines(): $str is "250-STARTTLS"<br>
SMTP -> get_lines(): $data is "250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [xx.xx.xx.x]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN250-STARTTLS"<br>
SMTP -> get_lines(): $str is "250 HELP"<br>
SERVER -> CLIENT: 250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [xx.xx.xx.x]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN250-STARTTLS250 HELP<br>
CLIENT -> SERVER: STARTTLS<br>
SMTP -> get_lines(): $data is ""<br>
SMTP -> get_lines(): $str is "220 TLS go ahead"<br>
SERVER -> CLIENT: 220 TLS go ahead<br>
CLIENT -> SERVER: EHLO myaccount.arvixeshared.com<br>
SMTP -> get_lines(): $data is ""<br>
SMTP -> get_lines(): $str is "250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [xx.xx.xx.x]"<br>
SMTP -> get_lines(): $data is "250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [xx.xx.xx.x]"<br>
SMTP -> get_lines(): $str is "250-SIZE 52428800"<br>
SMTP -> get_lines(): $data is "250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [xx.xx.xx.x]250-SIZE 52428800"<br>
SMTP -> get_lines(): $str is "250-8BITMIME"<br>
SMTP -> get_lines(): $data is "250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [xx.xx.xx.x]250-SIZE 52428800250-8BITMIME"<br>
SMTP -> get_lines(): $str is "250-PIPELINING"<br>
SMTP -> get_lines(): $data is "250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [xx.xx.xx.x]250-SIZE 52428800250-8BITMIME250-PIPELINING"<br>
SMTP -> get_lines(): $str is "250-AUTH PLAIN LOGIN"<br>
SMTP -> get_lines(): $data is "250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [xx.xx.xx.x]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN"<br>
SMTP -> get_lines(): $str is "250 HELP"<br>
SERVER -> CLIENT: 250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [xx.xx.xx.x]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN250 HELP<br>
Auth method requested: UNKNOWN<br>
Auth methods available on the server: PLAIN,LOGIN<br>
Auth method selected: LOGIN<br>
CLIENT -> SERVER: AUTH LOGIN<br>
SMTP -> get_lines(): $data is ""<br>
SMTP -> get_lines(): $str is "334 XXXxxxxxxXXx"<br>
SERVER -> CLIENT: 334 XXXxxxxxxXXx<br>
CLIENT -> SERVER: XXxxxxXxXXxxXXXxXXxxXXxxXxXxxX==<br>
SMTP -> get_lines(): $data is ""<br>
SMTP -> get_lines(): $str is "334 XXXxxxxxxxXx"<br>
SERVER -> CLIENT: 334 XXXxxxxxxxXx<br>
CLIENT -> SERVER: YW5pczE5OTY=<br>
SMTP -> get_lines(): $data is ""<br>
SMTP -> get_lines(): $str is "535 Incorrect authentication data"<br>
SERVER -> CLIENT: 535 Incorrect authentication data<br>
SMTP ERROR: Password command failed: 535 Incorrect authentication data<br>
SMTP Error: Could not authenticate.<br>
CLIENT -> SERVER: QUIT<br>
SMTP -> get_lines(): $data is ""<br>
SMTP -> get_lines(): $str is "221 myaccount.arvixeshared.com closing connection"<br>
SERVER -> CLIENT: 221 myaccount.arvixeshared.com closing connection<br>
Connection: closed<br>
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting<br>
Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
I'm sure that password is correct, I tried this code in another account and works fine. I contacted my host but without a solution, what I've noticed is that is SERVER -> CLIENT & CLENT -> SERVER are the same (localhost):
SERVER -> CLIENT: 220-myaccount.arvixeshared.com ESMTP Exim 4.87 #1 Sun, 19 Mar 2017 00:57:26 -0400 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.<br>
CLIENT -> SERVER: EHLO myaccount.arvixeshared.com<br>
Where in the account where the code works SERVER -> CLIENT (smtp.gmail.com) & CLIENT -> SERVER (localhost):
SERVER -> CLIENT: 220 smtp.gmail.com ESMTP x29xx4280503xxx.16 - gsmtp<br>
CLIENT -> SERVER: EHLO myaccount.hawkhost.com<br>
Can someone help me to solve this issue, thanks.
Update:
activating certificate verification and using php 7.0
username#domain.com [~/path/e]# /usr/local/php70/bin/php -f gmail.php
2017-03-19 12:58:06 Connection: opening to smtp.gmail.com:587, timeout=300, options=array (
)
2017-03-19 12:58:06 Connection: opened
2017-03-19 12:58:06 SMTP -> get_lines(): $data is ""
2017-03-19 12:58:06 SMTP -> get_lines(): $str is "220-myaccount.arvixeshared.com ESMTP Exim 4.87 #1 Sun, 19 Mar 2017 08:58:06 -0400
"
2017-03-19 12:58:06 SMTP -> get_lines(): $data is "220-myaccount.arvixeshared.com ESMTP Exim 4.87 #1 Sun, 19 Mar 2017 08:58:06 -0400
"
2017-03-19 12:58:06 SMTP -> get_lines(): $str is "220-We do not authorize the use of this system to transport unsolicited,
"
2017-03-19 12:58:06 SMTP -> get_lines(): $data is "220-myaccount.arvixeshared.com ESMTP Exim 4.87 #1 Sun, 19 Mar 2017 08:58:06 -0400
220-We do not authorize the use of this system to transport unsolicited,
"
2017-03-19 12:58:06 SMTP -> get_lines(): $str is "220 and/or bulk e-mail.
"
2017-03-19 12:58:06 SERVER -> CLIENT: 220-myaccount.arvixeshared.com ESMTP Exim 4.87 #1 Sun, 19 Mar 2017 08:58:06 -0400
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.
2017-03-19 12:58:06 CLIENT -> SERVER: EHLO myaccount.arvixeshared.com
2017-03-19 12:58:06 SMTP -> get_lines(): $data is ""
2017-03-19 12:58:06 SMTP -> get_lines(): $str is "250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [23.91.70.2]
"
2017-03-19 12:58:06 SMTP -> get_lines(): $data is "250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [23.91.70.2]
"
2017-03-19 12:58:06 SMTP -> get_lines(): $str is "250-SIZE 52428800
"
2017-03-19 12:58:06 SMTP -> get_lines(): $data is "250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [23.91.70.2]
250-SIZE 52428800
"
2017-03-19 12:58:06 SMTP -> get_lines(): $str is "250-8BITMIME
"
2017-03-19 12:58:06 SMTP -> get_lines(): $data is "250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [23.91.70.2]
250-SIZE 52428800
250-8BITMIME
"
2017-03-19 12:58:06 SMTP -> get_lines(): $str is "250-PIPELINING
"
2017-03-19 12:58:06 SMTP -> get_lines(): $data is "250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [23.91.70.2]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
"
2017-03-19 12:58:06 SMTP -> get_lines(): $str is "250-AUTH PLAIN LOGIN
"
2017-03-19 12:58:06 SMTP -> get_lines(): $data is "250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [23.91.70.2]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-AUTH PLAIN LOGIN
"
2017-03-19 12:58:06 SMTP -> get_lines(): $str is "250-STARTTLS
"
2017-03-19 12:58:06 SMTP -> get_lines(): $data is "250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [23.91.70.2]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-AUTH PLAIN LOGIN
250-STARTTLS
"
2017-03-19 12:58:06 SMTP -> get_lines(): $str is "250 HELP
"
2017-03-19 12:58:06 SERVER -> CLIENT: 250-myaccount.arvixeshared.com Hello myaccount.arvixeshared.com [23.91.70.2]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-AUTH PLAIN LOGIN
250-STARTTLS
250 HELP
2017-03-19 12:58:06 CLIENT -> SERVER: STARTTLS
2017-03-19 12:58:06 SMTP -> get_lines(): $data is ""
2017-03-19 12:58:06 SMTP -> get_lines(): $str is "220 TLS go ahead
"
2017-03-19 12:58:06 SERVER -> CLIENT: 220 TLS go ahead
2017-03-19 12:58:06 Connection failed. Error #2: stream_socket_enable_crypto(): Peer certificate CN=`*.arvixeshared.com' did not match expected CN=`smtp.gmail.com' [/home/username/path/p/class.smtp.php line 368]
2017-03-19 12:58:06 SMTP Error: Could not connect to SMTP host.
2017-03-19 12:58:06 CLIENT -> SERVER: QUIT
2017-03-19 12:58:06 SMTP -> get_lines(): $data is ""
2017-03-19 12:58:06 SMTP -> get_lines(): $str is "221 myaccount.arvixeshared.com closing connection
"
2017-03-19 12:58:06 SERVER -> CLIENT: 221 myaccount.arvixeshared.com closing connection
2017-03-19 12:58:06 Connection: closed
2017-03-19 12:58:06 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
It looks like your ISP is intercepting and redirecting your SMTP traffic to their own server. You are asking to connect to smtp.gmail.com, but it is connecting to myaccount.arvixieshared.com, where of course your credentials do not work.
This is covered in the troubleshooting guide that the error message links to.
It should be failing to connect because the TLS certificates do not match, so you are either using an old PHP version or you have disabled certificate verification, neither of which are a good idea.
After 4 days of chatting with Arvixe support, this is the conclusion:
If it happens and you had a problem with them don't bother yourself, move away. #Synchro, thank you again for your help and your advice that I didn't listen to it (get a better ISP).
This is my last chat with them:
3:20:07 PM
System
Hitesh N has joined the chat!
3:20:31 PM
aissam
My Support Code:
XXXXXX-XXXXX
3:20:44 PM
Hitesh N
Hello Aissam. Welcome to Arvixe live chat, My name is Hitesh. How may I assist you?
3:22:08 PM
aissam
for the fourth day, could you please fix my problem and please don't say I will pass it to my supervisor or administrator, because you don't have such a thing
3:22:18 PM
aissam
03/19/17 [dallas134.arvixeshared.com]PHp mailer fucntion issue XXX-XXX-XXXXX
3:22:25 PM
Hitesh N
Could I place you on hold for 3-4 minutes while I check this for you?
3:22:54 PM
aissam
Okay
3:34:42 PM
Hitesh N
I am still working on your issue.
3:40:32 PM
aissam
Okay take your time
3:53:15 PM
Hitesh N
May I know when the issue started?
3:55:26 PM
aissam
before about one week
4:03:56 PM
Hitesh N
I am still working on your issue. Sorry for delay.
4:10:43 PM
Hitesh N
Sorry for long delay.
4:11:00 PM
Hitesh N
My tech confirmed that your issue was already escalated the Sysadmins to check further.
4:11:12 PM
Hitesh N
But as there are huge number of tickets, its getting delayed.
4:11:49 PM
Hitesh N
Now, we have again requested them to check further and update you.
4:12:00 PM
Hitesh N
I know we have delayed a lot, sorry for that.
4:13:46 PM
aissam
please don't tell that, smtp is essential, my platform is using it for sending email, now I'm just receiving I can't send, and if I send the messages goes through your smtp server and they are all classified spam
4:14:04 PM
aissam
this is not an issue that need more than one day to be resolved
4:14:29 PM
aissam
why your server is redirect me to localhost and doesn't allow me to connect to external smtp?
4:15:25 PM
Hitesh N
Unfortunately, I don't know the reason behind it as of now.
4:15:41 PM
Hitesh N
Our sysadmins have to check the logs to get more info on it.
4:16:23 PM
Hitesh N
I don't know if its possible, as I don't know about the scripts much.
4:16:33 PM
aissam
move me to another server unit the virtual admin or supervisor that previous three agents told me about will check the issue perhaps in 2030
4:16:50 PM
Hitesh N
But normally for emails sent which are going to spam box, we suggest to add spf record. Is that possible in your scripts?
4:17:18 PM
aissam
I've added spf the same thing always to spam folder
4:17:28 PM
aissam
which scripts you're talking about?
4:17:51 PM
Hitesh N
I meant in your PHP mail function.
4:18:46 PM
aissam
my problem isn't with script, how you can solve my problem if you don't understand it. the three idiot before told that they passed all information to ticket, I think they didn't
4:19:26 PM
Hitesh N
All have passed the ticket to sysadmins but as there are already ticket in sysadmins pool, its taking time.
4:21:46 PM
aissam
my problem isn't with script, my problem is that your server doesn't allow me to connect to external smtp, and keep redirect me to your smtp server when I'm asking to connect to smtp.gmail.com or another smtp server. please update my problem, I don't have problems with scripts, they are just for testing purpose to debug the problem (I've used PHPMail, SwiftMail, PHP+Pear), I'm helping you in debug of problem and you're saying that I have problem with script?
4:22:09 PM
Hitesh N
No, I didn't mean that Aissam. I didn't.
4:22:26 PM
Hitesh N
As I said, I don't know much about the issue, I just referred about adding spf record.
4:22:37 PM
Hitesh N
But as you mentioned, spf record is already present.
4:24:04 PM
aissam
This is very well known problem about emails sending, if you need to be professional use external smtp (special on that domain) and specifically don't use smtp of shared account
4:24:40 PM
aissam
and it's not a problem with you smtp server it's for all ISP
4:24:48 PM
Hitesh N
I have updating all of your inputs in ticket for our sysadmins review. It will be helpful.
4:25:34 PM
aissam
Thank you for your help, but whereis this admin. Am I the only one who have this issue in dallas134
4:25:45 PM
aissam
Is it a global issue?
4:26:27 PM
Hitesh N
I'm not sure Aissam, because as of now we have not received any report of email failure on server: dallas134.arvixeshared.com
4:27:05 PM
Hitesh N
I will ask with my tech, a moment.
4:27:30 PM
aissam
so the problem is only within my account, also I have another problem with it. I can't buy anything until i contact you
4:27:50 PM
aissam
when it's time to generate the invoice I get an error "enter email address"
4:28:30 PM
Hitesh N
I'm sorry for that.
4:29:37 PM
aissam
you don't have an account for testing purpose in this server?
4:30:04 PM
Hitesh N
No.
4:30:54 PM
aissam
what tech said about dallas134?
4:31:32 PM
Hitesh N
There is no known issue on email functionality on server.
4:32:44 PM
aissam
I know that, I can send email using your smtp without problem, ask them about why they are blocking connection to external smtp?
4:36:47 PM
Hitesh N
They confirmed that there is no blocking of connection to external smtp.
4:36:58 PM
Hitesh N
Regarding your issue, we need to check further.
4:39:30 PM
aissam
Honestly, since December 2016, You couldn't fix simple issue which is related to generation of invoices in my account, and whenever I need to buy a domain or simple thing I need to contact you to generate the invoice on behalf of me. how you could solve this complicated issue?
4:40:06 PM
aissam
You have two solutions, to keep ignoring me like you're doing know, or to move me to another account
4:41:18 PM
Hitesh N
The invoice issue is being worked upon from many time as we got update that ISP is also a reason in it.
4:41:23 PM
Hitesh N
Its still ongoing.
4:41:44 PM
Hitesh N
Regarding the issue, we will surely help you.
4:43:05 PM
aissam
When? 2017 or 2030?
4:45:30 PM
Hitesh N
We will surely help you asap.

Perl code, I don't understand the error outputted

#!perl
use warnings;
use strict;
use Net::SMTP;
my $smtpserver = 'server';
my $smtpport = 25;
my $smtpuser = 'username';
my $smtppassword = 'password';
my $smtp = Net::SMTP->new($smtpserver, Port=>$smtpport, Timeout => 10, Debug => 1);
die "Could not connect to server!\n" unless $smtp;
$smtp->auth($smtpuser, $smtppassword);
$smtp->mail('sender#example.com');
$smtp->to('mymail#gmail.com');
$smtp->data();
$smtp->datasend("To: mymail\#gmail.com\n");
$smtp->datasend("bla bla bla ... \n");
$smtp->quit;
When I execute this code I got the below output. I don't have much more knowledge about perl but the project is Perl, thus I must do it this way.
What is happening below: I do not understand it personally.
Net::SMTP>>> Net::SMTP(2.29)
Net::SMTP>>> Net::Cmd(2.26)
Net::SMTP>>> Exporter(5.58)enter code here
Net::SMTP>>> IO::Socket::INET(1.27)
Net::SMTP>>> IO::Socket(1.28)
Net::SMTP>>> IO::Handle(1.24)
Net::SMTP=GLOB(0x7a6280)<<< 220 server ESMTP Sendmail 8.13.1/8.13.1; Sun, 6 Dec 2015 19:34:41 +0530
Net::SMTP=GLOB(0x7a6280)>>> EHLO localhost.localdomain
Net::SMTP=GLOB(0x7a6280)<<< 250-server Hello localhost.localdomain [127.0.0.1], pleased to meet you
Net::SMTP=GLOB(0x7a6280)<<< 250-ENHANCEDSTATUSCODES
Net::SMTP=GLOB(0x7a6280)<<< 250-PIPELINING
Net::SMTP=GLOB(0x7a6280)<<< 250-8BITMIME
Net::SMTP=GLOB(0x7a6280)<<< 250-SIZE
Net::SMTP=GLOB(0x7a6280)<<< 250-DSN
Net::SMTP=GLOB(0x7a6280)<<< 250-ETRN
Net::SMTP=GLOB(0x7a6280)<<< 250-AUTH GSSAPI DIGEST-MD5 CRAM-MD5
Net::SMTP=GLOB(0x7a6280)<<< 250-DELIVERBY
Net::SMTP=GLOB(0x7a6280)<<< 250 HELP
Net::SMTP=GLOB(0x7a6280)>>> MAIL FROM:<sendermail>
Net::SMTP=GLOB(0x7a6280)<<< 250 2.1.0 <sendermail>... Sender ok
Net::SMTP=GLOB(0x7a6280)>>> RCPT TO:<receipient mail>
Net::SMTP=GLOB(0x7a6280)<<< 250 2.1.5 <recipient mail>... Recipient ok
Net::SMTP=GLOB(0x7a6280)>>> DATA
Net::SMTP=GLOB(0x7a6280)<<< 354 Enter mail, end with "." on a line by itself
Net::SMTP=GLOB(0x7a6280)>>> To: mymail#gmail.com
Net::SMTP=GLOB(0x7a6280)>>> .
Net::SMTP=GLOB(0x7a6280)<<< 250 2.0.0 tB6EJbum025820 Message accepted for delivery
Net::SMTP=GLOB(0x7a6280)>>> QUIT
Net::SMTP=GLOB(0x7a6280)<<< 221 2.0.0 server closing connection
I will be very grateful for any help — thanks in advance.
I don't understand the error outputted
You didn't show us any error. As you can see, the server said "Message accepted for delivery".
The missing ->dataend might mean you are sending an empty email, though.
What is happening below
An email message is being sent. As well, messages to help you debug problems are being outputted since you requested these using Debug => 1.