次のエラーが表示されます。認証資格が無効です。SMTPを使用するPHPMailerを使用したAWS SES:SMTPエラー:認証できませんでしたか?
ユーザー名(アクセスキーID)とパスワード(シークレットトークン)を何百回もチェックしました。私は、サーバーに送られたbase64をダブルチェックして、それが正しいです。ユーザーには正しいアクセス権があります。 EC2サーバーからのすべてのアウトバウンドトラフィックが許可されます。 SELinuxは無効です。私は特殊文字をエスケープし、別の資格情報を試しました。より多くのアクセス権を持つユーザーを使用しようとしました。
私はAWS SESでPHPMailerを使用しています。ここで
はコードです:ここでは
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'tls';
$mail->SMTPDebug = 4;
$mail->setFrom('[email protected]', 'Sender Name');
$mail->addAddress('[email protected]', 'Recipient Name');
$mail->Username = 'AKIAINH6PZ2UQKDK2BTA';
$mail->Password = 'GvMMa7R3fAXZGacl3gyfA86J0RxJLO7FQte9vrof';
$mail->Host = 'email-smtp.us-east-1.amazonaws.com';
$mail->Subject = 'Amazon SES test (SMTP interface accessed using PHP)';
$mail->Body = '<h1>Email Test</h1>';
$mail->Port = 587;
$mail->isHTML(true);
$mail->AltBody = "Email Test\r\nThis email was sent through the
Amazon SES SMTP interface using the PHPMailer class.";
if(!$mail->send()) {
echo "Email not sent. " , $mail->ErrorInfo , PHP_EOL;
} else {
echo "Email sent!" , PHP_EOL;
}
は完全な出力です:
2017-11-06 01:09:49 Connection: opening to email-smtp.us-east-1.amazonaws.com:587, timeout=300, options=array()
2017-11-06 01:09:49 Connection: opened
2017-11-06 01:09:49 SMTP -> get_lines(): $data is ""
2017-11-06 01:09:49 SMTP -> get_lines(): $str is "220 email-smtp.amazonaws.com ESMTP SimpleEmailService-2367521455 ZxpFMwcwQB6LGlJ2noyc"
2017-11-06 01:09:49 SERVER -> CLIENT: 220 email-smtp.amazonaws.com ESMTP SimpleEmailService-2367521455 ZxpFMwcwQB6LGlJ2noyc
2017-11-06 01:09:49 CLIENT -> SERVER: EHLO 34.200.216.237
2017-11-06 01:09:49 SMTP -> get_lines(): $data is ""
2017-11-06 01:09:49 SMTP -> get_lines(): $str is "250-email-smtp.amazonaws.com"
2017-11-06 01:09:49 SMTP -> get_lines(): $data is "250-email-smtp.amazonaws.com"
2017-11-06 01:09:49 SMTP -> get_lines(): $str is "250-8BITMIME"
2017-11-06 01:09:49 SMTP -> get_lines(): $data is "250-email-smtp.amazonaws.com250-8BITMIME"
2017-11-06 01:09:49 SMTP -> get_lines(): $str is "250-SIZE 10485760"
2017-11-06 01:09:49 SMTP -> get_lines(): $data is "250-email-smtp.amazonaws.com250-8BITMIME250-SIZE 10485760"
2017-11-06 01:09:49 SMTP -> get_lines(): $str is "250-STARTTLS"
2017-11-06 01:09:49 SMTP -> get_lines(): $data is "250-email-smtp.amazonaws.com250-8BITMIME250-SIZE 10485760250-STARTTLS"
2017-11-06 01:09:49 SMTP -> get_lines(): $str is "250-AUTH PLAIN LOGIN"
2017-11-06 01:09:49 SMTP -> get_lines(): $data is "250-email-smtp.amazonaws.com250-8BITMIME250-SIZE 10485760250-STARTTLS250-AUTH PLAIN LOGIN"
2017-11-06 01:09:49 SMTP -> get_lines(): $str is "250 Ok"
2017-11-06 01:09:49 SERVER -> CLIENT: 250-email-smtp.amazonaws.com250-8BITMIME250-SIZE 10485760250-STARTTLS250-AUTH PLAIN LOGIN250 Ok
2017-11-06 01:09:49 CLIENT -> SERVER: STARTTLS
2017-11-06 01:09:49 SMTP -> get_lines(): $data is ""
2017-11-06 01:09:49 SMTP -> get_lines(): $str is "220 Ready to start TLS"
2017-11-06 01:09:49 SERVER -> CLIENT: 220 Ready to start TLS
2017-11-06 01:09:49 CLIENT -> SERVER: EHLO 34.200.216.237
2017-11-06 01:09:49 SMTP -> get_lines(): $data is ""
2017-11-06 01:09:49 SMTP -> get_lines(): $str is "250-email-smtp.amazonaws.com"
2017-11-06 01:09:49 SMTP -> get_lines(): $data is "250-email-smtp.amazonaws.com"
2017-11-06 01:09:49 SMTP -> get_lines(): $str is "250-8BITMIME"
2017-11-06 01:09:49 SMTP -> get_lines(): $data is "250-email-smtp.amazonaws.com250-8BITMIME"
2017-11-06 01:09:49 SMTP -> get_lines(): $str is "250-SIZE 10485760"
2017-11-06 01:09:49 SMTP -> get_lines(): $data is "250-email-smtp.amazonaws.com250-8BITMIME250-SIZE 10485760"
2017-11-06 01:09:49 SMTP -> get_lines(): $str is "250-STARTTLS"
2017-11-06 01:09:49 SMTP -> get_lines(): $data is "250-email-smtp.amazonaws.com250-8BITMIME250-SIZE 10485760250-STARTTLS"
2017-11-06 01:09:49 SMTP -> get_lines(): $str is "250-AUTH PLAIN LOGIN"
2017-11-06 01:09:49 SMTP -> get_lines(): $data is "250-email-smtp.amazonaws.com250-8BITMIME250-SIZE 10485760250-STARTTLS250-AUTH PLAIN LOGIN"
2017-11-06 01:09:49 SMTP -> get_lines(): $str is "250 Ok"
2017-11-06 01:09:49 SERVER -> CLIENT: 250-email-smtp.amazonaws.com250-8BITMIME250-SIZE 10485760250-STARTTLS250-AUTH PLAIN LOGIN250 Ok
2017-11-06 01:09:49 Auth method requested: UNKNOWN
2017-11-06 01:09:49 Auth methods available on the server: PLAIN,LOGIN
2017-11-06 01:09:49 Auth method selected: LOGIN
2017-11-06 01:09:49 CLIENT -> SERVER: AUTH LOGIN
2017-11-06 01:09:49 SMTP -> get_lines(): $data is ""
2017-11-06 01:09:49 SMTP -> get_lines(): $str is "334 VXNlcm5hbWU6"
2017-11-06 01:09:49 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2017-11-06 01:09:49 CLIENT -> SERVER: QUtJQUlOSDZQWjJVUUtESzJCVEE=
2017-11-06 01:09:49 SMTP -> get_lines(): $data is ""
2017-11-06 01:09:49 SMTP -> get_lines(): $str is "334 UGFzc3dvcmQ6"
2017-11-06 01:09:49 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2017-11-06 01:09:49 CLIENT -> SERVER: R3ZNTWE3UjNmQVhaR2FjbDNneWZBODZKMFJ4SkxPN0ZRdGU5dnJvZg==
2017-11-06 01:09:50 SMTP -> get_lines(): $data is ""
2017-11-06 01:09:50 SMTP -> get_lines(): $str is "535 Authentication Credentials Invalid"
2017-11-06 01:09:50 SERVER -> CLIENT: 535 Authentication Credentials Invalid
2017-11-06 01:09:50 SMTP ERROR: Password command failed: 535 Authentication Credentials Invalid
SMTP Error: Could not authenticate.
2017-11-06 01:09:50 CLIENT -> SERVER: QUIT
2017-11-06 01:09:50 SMTP -> get_lines(): $data is ""
2017-11-06 01:09:50 SMTP -> get_lines(): $str is "221 Bye"
2017-11-06 01:09:50 SERVER -> CLIENT: 221 Bye
2017-11-06 01:09:50 Connection: closed
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Email not sent. SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
でこの関数を呼び出すことができます – Synchro