[ZendTo] Support for custom mail headers
Adam Thorn
alt36 at cam.ac.uk
Mon Jul 10 15:54:27 BST 2023
Would it be possible to add support for specifying custom mail headers
to the mails sent by ZendTo? My specific use case is to be able to
specify a header specific to Exchange Online which controls the sending
of various out-of-office-type autoreplies..
https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcmail/ced68690-498a-4567-9d14-5c01f974d8b1
..on the basis that I know that header is useful for many of my recipients.
It looks like for PHPMailer one calls $mail->addCustomHeader() :
https://phpmailer.github.io/PHPMailer/classes/PHPMailer-PHPMailer-PHPMailer.html#method_addCustomHeader
whereas for php's mail() one just appends to the $header string that
gets eventually passed to mail().
mail() expects a raw header line in the form 'Header-Name:
Header-Value', whereas PHPMailer supports being called either with two
arguments:
$mail->addCustomHeader('Header-Name', 'Header-Value');
or with just a single argument of the same form that could be given
directly to mail():
$mail->addCustomHeader('Header-Name: Header-Value');
Thus, it might be simpler to go for the second form and to have an
optional array one could specify in the preferences of the form..
$prefs = array(
...
'extraMailHeaders' => array(
'My-First-Header: Foo',
'My-Second-Header: Bar',
),
...
);
which can then either be immediately passed to addCustomHeader() or
imploded and added to $headers, as appropriate.
Regards,
Adam
More information about the ZendTo
mailing list