535 Incorrect authentication data to SES using PHPMailer and SES SMTP username and password

0

We are trying to connect using PHPMailer to Amazon SES.

This is an older system on PHP 7.2., I know...

  $mail = new PHPMailer;
            $mail->isSMTP();                                                        // Set mailer to use SMTP
            $mail->SMTPDebug = 4;
            $mail->Host = 'email-smtp.us-east-1.amazonaws.com';           // Specify main and backup SMTP servers
            //$mail->Host = 'email-smtp.us-west-2.amazonaws.com';
            $mail->SMTPAuth = true;                                             // Enable SMTP authentication
            $mail->Username =  'AKIA[REDACTED]NPK';                           // SMTP username
            $mail->Password = 'BA7EW[REDACTED]vJbHUjvp';                           // SMTP password
            $mail->SMTPSecure = 'tls';                                          // Enable TLS encryption, `ssl` also accepted
            $mail->Port = 587;
            $mail->SMTPOptions = array(
    'ssl' => array(
        'verify_peer' => false,
        'verify_peer_name' => false,
        'allow_self_signed' => true
    )
);

 $mail->setFrom("no-reply@VALIDATEDDOMAIN.com");

            $mail->addAddress(VALIDATEDEMAIL@ourdomain.com); 
            $mail->isHTML(true);
            $mail->Subject = $subject;
            $mail->Body = $body;
            if(!$mail->send()){
echo $mail->ErrorInfo;
}

The username and password was create in the create SMTP credentials, and the CSV was downloaded.

This is the CSV:

IAM User Name,Smtp Username,Smtp Password
"test_user",AKIA[REDACTED]NPK,BA7EW[REDACTED]vJbHUjvp

Multiple ones were created and tested.

Our test region is apparently US-WEST-2. but we ceate them in US-EAST-1. Both were tested, as you can see in the commented out line above.

When I download the list of users

I get:

user,arn,user_creation_time,password_enabled,password_last_used,password_last_changed,password_next_rotation,mfa_active,access_key_1_active,access_key_1_last_rotated,access_key_1_last_used_date,access_key_1_last_used_region,access_key_1_last_used_service,
test_user,arn:aws:iam::7389[REDACTED]188:user/test_user,2022-12-12T20:00:12+00:00,false,N/A,N/A,N/A,false,true,2022-12-12T20:00:12+00:00,N/A,N/A,N/A,false,N/A,N/A,N/A,N/A,false,N/A,false,N/A

Here is the level 3 logs from PHPMailer, edited for confidentiality:

2022-12-13 14:21:58 Connection: opening to email-smtp.us-east-1.amazonaws.com:587, timeout=300, options=array ( 'ssl' => array ( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true, ),)
2022-12-13 14:21:58 Connection: opened
2022-12-13 14:21:58 SMTP INBOUND: "220-##MYSERVER## ESMTP Exim 4.95 #2 Tue, 13 Dec 2022 09:21:58 -0500"
2022-12-13 14:21:58 SMTP INBOUND: "220-We do not authorize the use of this system to transport unsolicited,"
2022-12-13 14:21:58 SMTP INBOUND: "220 and/or bulk e-mail."
2022-12-13 14:21:58 SERVER -> CLIENT: 220-##MYSERVER## ESMTP Exim 4.95 #2 Tue, 13 Dec 2022 09:21:58 -0500 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
2022-12-13 14:21:58 CLIENT -> SERVER: EHLO ##MYDOMAIN##
2022-12-13 14:21:58 SMTP INBOUND: "250-##MYSERVER## Hello ##MYDOMAIN## [##MYSERVERIP###]"
2022-12-13 14:21:58 SMTP INBOUND: "250-SIZE 52428800"
2022-12-13 14:21:58 SMTP INBOUND: "250-8BITMIME"
2022-12-13 14:21:58 SMTP INBOUND: "250-PIPELINING"
2022-12-13 14:21:58 SMTP INBOUND: "250-PIPE_CONNECT"
2022-12-13 14:21:58 SMTP INBOUND: "250-AUTH PLAIN LOGIN"
2022-12-13 14:21:58 SMTP INBOUND: "250-STARTTLS"
2022-12-13 14:21:58 SMTP INBOUND: "250 HELP"
2022-12-13 14:21:58 SERVER -> CLIENT: 250-##MYSERVER## Hello ##MYDOMAIN## [##MYSERVERIP###]250-SIZE 52428800250-8BITMIME250-PIPELINING250-PIPE_CONNECT250-AUTH PLAIN LOGIN250-STARTTLS250 HELP
2022-12-13 14:21:58 CLIENT -> SERVER: STARTTLS
2022-12-13 14:21:58 SMTP INBOUND: "220 TLS go ahead"
2022-12-13 14:21:58 SERVER -> CLIENT: 220 TLS go ahead
2022-12-13 14:21:58 CLIENT -> SERVER: EHLO ##MYDOMAIN##
2022-12-13 14:21:58 SMTP INBOUND: "250-##MYSERVER## Hello ##MYDOMAIN## [##MYSERVERIP###]"
2022-12-13 14:21:58 SMTP INBOUND: "250-SIZE 52428800"
2022-12-13 14:21:58 SMTP INBOUND: "250-8BITMIME"
2022-12-13 14:21:58 SMTP INBOUND: "250-PIPELINING"
2022-12-13 14:21:58 SMTP INBOUND: "250-PIPE_CONNECT"
2022-12-13 14:21:58 SMTP INBOUND: "250-AUTH PLAIN LOGIN"
2022-12-13 14:21:58 SMTP INBOUND: "250 HELP"
2022-12-13 14:21:58 SERVER -> CLIENT: 250-##MYSERVER## Hello ##MYDOMAIN## [##MYSERVERIP###]250-SIZE 52428800250-8BITMIME250-PIPELINING250-PIPE_CONNECT250-AUTH PLAIN LOGIN250 HELP
2022-12-13 14:21:58 Auth method requested: UNSPECIFIED
2022-12-13 14:21:58 Auth methods available on the server: PLAIN,LOGIN
2022-12-13 14:21:58 Requested auth method not available:
2022-12-13 14:21:58 Auth method selected: LOGIN
2022-12-13 14:21:58 CLIENT -> SERVER: AUTH LOGIN
2022-12-13 14:21:58 SMTP INBOUND: "334 VXNlcm5hbWU6"
2022-12-13 14:21:58 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2022-12-13 14:21:58 CLIENT -> SERVER: QUtJQTJZRE1IU0QyQU1HRlpOUEs=
2022-12-13 14:21:58 SMTP INBOUND: "334 UGFzc3dvcmQ6"
2022-12-13 14:21:58 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2022-12-13 14:21:58 CLIENT -> SERVER: QkE3RVcyYUdNaUMzYTFYWFVXOU80QkQyak51aTluN2IzNTZxdkpiSFVqdnA=
2022-12-13 14:22:00 SMTP INBOUND: "535 Incorrect authentication data"
2022-12-13 14:22:00 SERVER -> CLIENT: 535 Incorrect authentication data
2022-12-13 14:22:00 SMTP ERROR: Password command failed: 535 Incorrect authentication data
SMTP Error: Could not authenticate.
2022-12-13 14:22:00 CLIENT -> SERVER: QUIT
2022-12-13 14:22:00 SMTP INBOUND: "221 ##MYSERVER## closing connection"
2022-12-13 14:22:00 SERVER -> CLIENT: 221 ##MYSERVER## closing connection
2022-12-13 14:22:00 Connection: closed
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
asked a year ago340 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions