我不使用 Symfony 框架。當我添加我的標題時
$mail = (new Email())
->from(new Address('[email protected]', 'Name'))
->to($recipient)
->subject($subject)
->html($body)
->getHeaders()
->addTextHeader('X-Auto-Response-Suppress', 'OOF, DR, RN, NRN, AutoReply');
然后 a$mailer->send($mail);不再起作用了:-(
如何發送郵件?
uj5u.com熱心網友回復:
getHeaders函式回傳一個標頭,因此在您的 中$mail,您沒有電子郵件,而是一個標頭
$mail = (new Email())
->from(new Address('[email protected]', 'Name'))
->to($recipient)
->subject($subject)
->html($body);
$headers = $mail->getHeaders();
$headers->addHeader('X-Auto-Response-Suppress', 'OOF, DR, RN, NRN, AutoReply');
$mail->setHeaders($headers);
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/456396.html
