SMTP relay not working on PHPMailer 6.0.5 - email

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().

Related

PHPmailer sending to yahoo address

I have set up the PHPmailer to have the To: and From: be the yahoo address (the $webem variable) and added a replyto address to be the actual user (the $FE variable).
I have also set up in yahoo an APP Password.
I tried sending both HTML and plain text emails from the form, but both get rejected.
PHPmailer setup:
$mail->Host = 'smtp.mail.yahoo.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = $webem; // SMTP username
$mail->Password = $epass; // SMTP password
$mail->SMTPSecure = 'ssl'; // Enable encryption, 'ssl' also accepted
$mail->Port = 465;
$mail->From = $webem;
$mail->addAddress($webem); // Add a recipient
$mail->addReplyTo($FE);
Response with SMTPDebug =2:
2020-06-03 01:36:40 SERVER -> CLIENT: 220 smtp.mail.yahoo.com ESMTP ready
2020-06-03 01:36:40 CLIENT -> SERVER: EHLO www.new2youwheelrestoration.com
2020-06-03 01:36:40 SERVER -> CLIENT: 250-smtp431.mail.gq1.yahoo.com Hello www.new2youwheelrestoration.com [73.27.216.5])
250-PIPELINING
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-SIZE 41697280
250 AUTH PLAIN LOGIN XOAUTH2 OAUTHBEARER
2020-06-03 01:36:40 CLIENT -> SERVER: AUTH LOGIN
2020-06-03 01:36:40 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2020-06-03 01:36:40 CLIENT -> SERVER: cnVja21uMUB5YWhvby5jb20=
2020-06-03 01:36:40 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2020-06-03 01:36:40 CLIENT -> SERVER: cnlua3Rma3l0dXB6Zm1jZA==
2020-06-03 01:36:40 SERVER -> CLIENT: 235 2.7.0 Authentication successful
2020-06-03 01:36:40 CLIENT -> SERVER: MAIL FROM:<ruckmn1#yahoo.com>
2020-06-03 01:36:40 SERVER -> CLIENT: 250 2.1.0 Sender <ruckmn1#yahoo.com> OK
2020-06-03 01:36:40 CLIENT -> SERVER: RCPT TO:<ruckmn1#yahoo.com>
2020-06-03 01:36:41 SERVER -> CLIENT: 250 2.1.5 Recipient <ruckmn1#yahoo.com> OK
2020-06-03 01:36:41 CLIENT -> SERVER: DATA
2020-06-03 01:36:41 SERVER -> CLIENT: 354 Ok Send data ending with <CRLF>.<CRLF>
2020-06-03 01:36:41 CLIENT -> SERVER: Date: Tue, 2 Jun 2020 21:36:39 -0400
2020-06-03 01:36:41 CLIENT -> SERVER: To: ruckmn1#yahoo.com
2020-06-03 01:36:41 CLIENT -> SERVER: From: Root User <ruckmn1#yahoo.com>
2020-06-03 01:36:41 CLIENT -> SERVER: Reply-To: patrick#patricklewis.net
2020-06-03 01:36:41 CLIENT -> SERVER: Subject:
2020-06-03 01:36:41 CLIENT -> SERVER: Message-ID: <4b835b094d049ffccbdf32174e9b7a48#www.new2youwheelrestoration.com>
2020-06-03 01:36:41 CLIENT -> SERVER: X-Priority: 3
2020-06-03 01:36:41 CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.8 (https://github.com/PHPMailer/PHPMailer/)
2020-06-03 01:36:41 CLIENT -> SERVER: MIME-Version: 1.0
2020-06-03 01:36:41 CLIENT -> SERVER: Content-Type: text/html; charset=iso-8859-1
2020-06-03 01:36:41 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
2020-06-03 01:36:41 CLIENT -> SERVER:
2020-06-03 01:36:41 CLIENT -> SERVER:
2020-06-03 01:36:41 CLIENT -> SERVER: testing web form
2020-06-03 01:36:41 CLIENT -> SERVER:
2020-06-03 01:36:41 CLIENT -> SERVER: Patrick
2020-06-03 01:36:41 CLIENT -> SERVER:
2020-06-03 01:36:41 CLIENT -> SERVER: patrick#patricklewis.net
2020-06-03 01:36:41 CLIENT -> SERVER:
2020-06-03 01:36:41 CLIENT -> SERVER:
2020-06-03 01:36:41 CLIENT -> SERVER:
2020-06-03 01:36:41 CLIENT -> SERVER:
2020-06-03 01:36:41 CLIENT -> SERVER:
2020-06-03 01:36:41 CLIENT -> SERVER: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13;
2020-06-03 01:36:41 CLIENT -> SERVER: rv:76.0) Gecko/20100101 Firefox/76.0
2020-06-03 01:36:41 CLIENT -> SERVER:
2020-06-03 01:36:41 CLIENT -> SERVER:
2020-06-03 01:36:41 CLIENT -> SERVER: .
2020-06-03 01:36:41 SERVER -> CLIENT: 550 Request failed; Mailbox unavailable
2020-06-03 01:36:41 SMTP ERROR: DATA END command failed: 550 Request failed; Mailbox unavailable
SMTP Error: data not accepted.
2020-06-03 01:36:41 CLIENT -> SERVER: QUIT
2020-06-03 01:36:41 SERVER -> CLIENT: 221 Service Closing transmission
How do I resolve the Mailbox unavailable/data not accepted error?
The only way I could get this to work is to remove the replyto address.
I set the from email to the yahoo account that I logged into and the to address to another yahoo account that my client uses.

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.

CentOS 6: cannot send email with PHPMailer but ok on laptop

I am designing a website on aliyun.com. This website includes a function to send emails with PHPMailer. It perfectly works on my laptop (a Mac Book Air running XAMPP) but not on the live server (a fresh CentOS 6) with exactly the same php files (SMTP host, password, ...). Here is below the log I got from PHPMailer in verbose mode:
2015-04-08 02:59:42 Connection: opening to smtp.mywebsite.com:587, t=300, opt=array (
)
2015-04-08 02:59:42 Connection: opened
2015-04-08 02:59:42 SERVER -> CLIENT: 220 smtp.aliyun-inc.com MX AliMail Server(10.194.100.112)
2015-04-08 02:59:42 CLIENT -> SERVER: EHLO mywebsite.com
2015-04-08 02:59:42 SERVER -> CLIENT: 250-smtp.aliyun-inc.com
250-8BITMIME
250-AUTH=PLAIN LOGIN XALIOAUTH
250-AUTH PLAIN LOGIN XALIOAUTH
250-PIPELINING
250 DSN
2015-04-08 02:59:42 CLIENT -> SERVER: STARTTLS
2015-04-08 02:59:42 SERVER -> CLIENT: 220 Ready to start TLS
2015-04-08 02:59:42 CLIENT -> SERVER: QUIT
2015-04-08 02:59:44 SERVER -> CLIENT: ��:%4P���pGC#mLa+�%YF�l �0���I
2015-04-08 02:59:44 SMTP ERROR: QUIT command failed: ��:%4P���pGC#mLa+�%YF�l �0���I
2015-04-08 02:59:44 Connection: closed
2015-04-08 02:59:44 SMTP connect() failed.
Although I spent many hours on internet looking for a solution, I cannot figure out where the problem comes from... I am using the latest release of PHPMailer and the function mail in command lines works well (I mean I receive them), so where the problem could from?
Thanks a lot in advance!
Alplob
Perhaps, the openssl PHP extension is not installed on the Centos server. You should make sure the openssl extension is installed. To check the installed extensions, try the following command on Centos:
php -i
and look for openssl in the resulting text.

CodeIgniter Mail + Exim4

i've set up Exim4 on my Ubuntu machine.
I've started learning CodeIgniter and when sending an e-mail through there email library i get the following if I ask for the debug status. Looks OK i suppose, but i never receive e-mail on jandante#telenet.be. Also doesn't work for jandante.meulemeester#gmail.com, anyone has an idea?
220 Concept-IT ESMTP Sendmail 8.14.3/8.14.3/Debian-9.1ubuntu1; Fri, 3 Sep 2010 18:15:59 +0200; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
hello: 250-Concept-IT Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-EXPN
250-VERB
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
from: 250 2.1.0 ... Sender ok
to: 250 2.1.5 ... Recipient ok
data: 354 Enter mail, end with "." on a line by itself
250 2.0.0 o83GFx3a021848 Message accepted for delivery
quit: 221 2.0.0 Concept-IT closing connection
Your message has been successfully sent using the following protocol: smtp
User-Agent: CodeIgniter
Date: Fri, 3 Sep 2010 18:15:59 +0200
From: "Concept-IT"
Return-Path:
To: jandante#telenet.be
Subject: =?utf-8?Q?Uw_nieuw_wachtwoord_voor_Concept-IT_CRM?=
Reply-To: "info#concept-it.be"
X-Sender: info#concept-it.be
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <4c811f3f98626#concept-it.be>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Uw gebruikersnaam is: liesbeth en uw wachtwoord is: 6ZiKJxD.
As you can read in my comments my problem comes from my ISP. Which doesn't allow me to send mail from my server.
I've followed the following tutorial to make Exim4 send mail through Google Mail: http://www.manu-j.com/blog/wordpress-exim4-ubuntu-gmail-smtp/.
Works like a charm.