由於AWS的SES找不到原因被暫停使用之後改用gmail
1.先把安全性降低https://myaccount.google.com/lesssecureapps?pli=1
否則在phpmailer寄信前登入會被擋掉
2.寫入phpmailer
$mail = new PHPMailer(true);
//Server settings
$mail->SMTPDebug = 0;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';//gmail的smtp網址
$mail->SMTPAuth = true;
$mail->Username = '信箱帳號';
$mail->Password = '信箱密碼';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587; //gmail的port
$mail->CharSet = 'utf8';
//Recipients
$mail->setFrom('輸入信箱', 'Yan二手書店');//寄信信箱