2017-10-03 6 views
0

これはLARAVELで使用しているPHP MAILERの構造です。LARAVELのSMTP connect()を持つPHPメーラー

$mail = new PHPMailer; 

$mail->isSMTP();       // Set mailer to use SMTP 
$mail->SMTPAuth = true;      // Enable SMTP authentication 
$mail->Username = '[email protected]';   // SMTP username 
$mail->Password = 'xxxx'; // SMTP password 
$mail->Host = 'smtp.gmail.com'; 
$mail->SMTPSecure = 'ssl'; 
$mail->Port = 465; 

//Set the encryption system to use - ssl (deprecated) or tls 
$mail->setFrom('[email protected]', 'CodexWorld'); 
$mail->addReplyTo('[email protected]', 'CodexWorld'); 
$mail->addAddress('[email protected]'); // Add a recipient 
$mail->addAddress($data['email']); // Add a recipient 
$mail->isHTML(true); // Set email format to HTML 

$message = ' 

    <p>HELLO</p> 

'; 

$mail->msgHTML($message); 

try { 
    if(!$mail->send()) 
    { 
     echo $mail->ErrorInfo; 
    } else { 
     /*redirect*/ 
    } 

- 私の接続エラーに

SMTPを取得()が失敗しました。 https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

私はこの問題を誰に解決するかわかりません。誰も私を助けることができる?

+0

を使用して提案する Laravel Mail

上で確認することができますか? – user1506104

+0

[docsに記載されている]デバッグを有効にしましたか(https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting)? Googleのガイドに記載されている「安全性の低いアプリを有効にする」(https://support.google.com/a/answer/176600?hl=ja)ですか? Googleは、通常、 'from 'アドレスを偽造しようと厳しく厳しいです、' from'と 'reply-to'にGMailアドレスを使ってみましたか? –

+0

私のウェブサイトのSMTPを使用して既に修正済みです。 –

答えて

0

なぜ私はLaravelのメールドライバであるswiftmailer(デフォルトでは)の代わりにphpmailerを使用しているのか分かりません。あなたは、あなただけがphpmailerのを使用する必要がありますが、.envファイルを設定し、メールを変更する必要があるか、私はMailtrap

関連する問題