I don’t use the Symfony Framework. When I add my header like
$mail = (new Email()) ->from(new Address('info@example.com', 'Name')) ->to($recipient) ->subject($subject) ->html($body) ->getHeaders() ->addTextHeader('X-Auto-Response-Suppress', 'OOF, DR, RN, NRN, AutoReply');
then a $mailer->send($mail);
doesn’t work anymore:-(
How do I send mail?
Advertisement
Answer
getHeaders
functions return an header, so in your $mail
, you dont have an email but a Header
$mail = (new Email()) ->from(new Address('info@example.com', 'Name')) ->to($recipient) ->subject($subject) ->html($body); $headers = $mail->getHeaders(); $headers->addHeader('X-Auto-Response-Suppress', 'OOF, DR, RN, NRN, AutoReply'); $mail->setHeaders($headers);