5

I am using PHPMailer on EC2. My account is not in a sandbox and Im sending from verified email. Im getting no errors from PHPMailer and thats my log

2017-03-31 06:24:52 Connection: opening to email-smtp.us-west-2.amazonaws.com:587, timeout=300, options=array ( ) 
2017-03-31 06:24:52 Connection: opened 
2017-03-31 06:24:53 SERVER -> CLIENT: 220 email-smtp.amazonaws.com ESMTP SimpleEmailService-2007935443 svKFRJ5M6s1rqbMTRdZu 
2017-03-31 06:24:53 CLIENT -> SERVER: EHLO ***.domain 
2017-03-31 06:24:53 SERVER -> CLIENT: 250-email-smtp.amazonaws.com 250-8BITMIME 250-SIZE 10485760 250-STARTTLS 250-AUTH PLAIN LOGIN 250 Ok 
2017-03-31 06:24:53 CLIENT -> SERVER: STARTTLS 
2017-03-31 06:24:53 SERVER -> CLIENT: 220 Ready to start TLS 
2017-03-31 06:24:53 CLIENT -> SERVER: EHLO ***.domain 
2017-03-31 06:24:53 SERVER -> CLIENT: 250-email-smtp.amazonaws.com 250-8BITMIME 250-SIZE 10485760 250-STARTTLS 250-AUTH PLAIN LOGIN 250 Ok 
2017-03-31 06:24:53 CLIENT -> SERVER: AUTH LOGIN 
2017-03-31 06:24:53 SERVER -> CLIENT: 334 VXNlcm5hbWU6 
2017-03-31 06:24:53 CLIENT -> SERVER: xxx= 
2017-03-31 06:24:53 SERVER -> CLIENT: 334 UGFzc3dvcmQ6 
2017-03-31 06:24:53 CLIENT -> SERVER: xxx= 
2017-03-31 06:24:53 SERVER -> CLIENT: 235 Authentication successful. 
2017-03-31 06:24:53 CLIENT -> SERVER: MAIL FROM: 
2017-03-31 06:24:53 SERVER -> CLIENT: 250 Ok 
2017-03-31 06:24:53 CLIENT -> SERVER: RCPT TO: 
2017-03-31 06:24:53 SERVER -> CLIENT: 250 Ok 
2017-03-31 06:24:53 CLIENT -> SERVER: DATA 
2017-03-31 06:24:53 SERVER -> CLIENT: 354 End data with . 
2017-03-31 06:24:53 CLIENT -> SERVER: Date: Fri, 31 Mar 2017 06:24:52 +0000 
2017-03-31 06:24:53 CLIENT -> SERVER: To: NG 
2017-03-31 06:24:53 CLIENT -> SERVER: From: Me 
2017-03-31 06:24:53 CLIENT -> SERVER: Subject: New User Added 
2017-03-31 06:24:53 CLIENT -> SERVER: Message-ID: <8ada86808c4dc38c21d7ff5d64051951@***.domain> 
2017-03-31 06:24:53 CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.21 (https://github.com/PHPMailer/PHPMailer) 
2017-03-31 06:24:53 CLIENT -> SERVER: MIME-Version: 1.0 
2017-03-31 06:24:53 CLIENT -> SERVER: Content-Type: text/html; charset=iso-8859-1 
2017-03-31 06:24:53 CLIENT -> SERVER: 
2017-03-31 06:24:53 CLIENT -> SERVER: 123 
2017-03-31 06:24:53 CLIENT -> SERVER: 
2017-03-31 06:24:53 CLIENT -> SERVER: . 
2017-03-31 06:24:53 SERVER -> CLIENT: 250 Ok 0101015b2309bfbe-39a8cf31-ad57-4998-832d-94312b7ddfad-000000 
2017-03-31 06:24:53 CLIENT -> SERVER: QUIT 
2017-03-31 06:24:53 SERVER -> CLIENT: 221 Bye 
2017-03-31 06:24:53 Connection: closed 

This is my PHPMailer settings

$this->SMTPDebug = 3;

$this->Host = 'email-smtp.us-west-2.amazonaws.com';
$this->Username = '***';
$this->Password = '***';
$this->SMTPAuth = true;
$this->SMTPSecure = 'tls';
$this->Port = 587;
$this->isHTML(true);
$this->isSMTP();


$this->From = '***';
$this->FromName = '***';
$this->ReturnPath = '***';

I tried to send this to different email but it still not working. Here is actual code of sending

$mailer = new Mailer($API);
$mailer->Subject = 'New User Added';
$mailer->Body = '123';

$mailer->addAddress('***', '***');

if (!$mailer->send()) {
   throw new Exception($mailer->ErrorInfo);
} else {
    print_r('Sent');
}
Synchro
  • 35,538
  • 15
  • 81
  • 104
user256968
  • 371
  • 1
  • 5
  • 18
  • Which type of [delivery notification](http://docs.aws.amazon.com/ses/latest/DeveloperGuide/notifications.html) did you receive about the message, and what does it say? – Michael - sqlbot Mar 31 '17 at 09:29
  • Possible duplicate of [AWS EC2 email sending limit when using third party smtp server](http://stackoverflow.com/questions/26311747/aws-ec2-email-sending-limit-when-using-third-party-smtp-server) – Putnik Mar 31 '17 at 09:29
  • @sqlbot I only got this log from PHP. Didn't get any other notifications. – user256968 Mar 31 '17 at 14:54
  • @Putnik "If you aren't connecting to the 3rd party server on port 25, then there's absolutely no limit." I am connecting only 587 – user256968 Mar 31 '17 at 14:55
  • PHPMailer's involvement ends after successful submission. Any other problems you have are not to do with your code. I removed your password from your question - you might want to change it. – Synchro Mar 31 '17 at 20:24
  • I had moved my receiving address email service to another provider, but my web server still believed it had ownership, so emails coming from my web server never left the domain provider servers. When I checked my old webmail on existing web server, all of my automated mails were there. – Orbiting Eden Jan 15 '23 at 22:10

3 Answers3

7

I would suggest that you go to https://www.mail-tester.com/ and then copy the email address you see. Update your code and then send an email using PHPMailer to the address you copied. Assuming that your code does actually send the email, and it looks like your code is correct, then Mail Tester will show you what problems your email has.

Chris
  • 4,672
  • 13
  • 52
  • 93
1

As for me the problem was because I don't received mails from this address yet, so all mails fell in Spam folder

Acuna
  • 1,741
  • 17
  • 20
0

I had the same problem, and it dissapeared when I set $mail->Username = 'xx@xx.xx'; to the same address as in $mail->setFrom('xx@xx.xx')

TomoMiha
  • 1,218
  • 1
  • 14
  • 12