-1
私の問題を解決するために何時間も検索されていますが、失敗しました。メーラーエラーのエラー:SMTP connect()が失敗しました
これはXAMPPでGmail
に電子メールを送信し、このエラーを毎回取得する私の簡単なコードを使用phpmailerのです:
Message could not be sent.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
と、これは私のPHPコードです:
<?php
require_once('PHPMailer/PHPMailerAutoload.php');
$mail = new PHPMailer();
$mail->isSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->HOST = 'smtp.gmail.com';
$mail->PORT = '465';
$mail->isHTML();
$mail->Username = '##myemail##@gmail.com';
$mail->Password = '##mypass##';
$mail->SetFrom('[email protected]');
$mail->Subject = 'Hello World';
$mail->Body = 'A test email!';
$mail->AddAddress('[email protected]');
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
?>
私を助けてください。
wikiをチェックしましたか? https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting#smtp-error-could-not-connect-to-smtp-host – modsfabio
おそらく認証エラーがありますが、 '$ mail-> SMTPDebug = 2 'エラーの内容を教えてください。 – Linek
[PHPMailer、SMTP connect()はGmailでエラーに失敗しました](http://stackoverflow.com/questions/25924651/phpmailer-smtp-connect-failed-error-with-gmail) – Synchro