[ZendTo] Support for custom mail headers

jules at zend.to jules at zend.to
Fri Aug 25 14:41:18 BST 2023


Hi Adam,

That sounds a great idea. Didn't know you could make O365 do that.

I've added it as a new setting at the bottom of the SMTP* settings, 
called "SMTPextraHeaders". It's just a simple array of strings as you 
suggest.

It will be in the next release (which I'm actually working on!!).

Sorry this has taken so long, I haven't done any ZendTo maintenance in 
far too long.

Thanks!
Jules.

On 10/07/2023 3:54 pm, Adam Thorn via ZendTo wrote:
> 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
>
> _______________________________________________
> ZendTo mailing list
> ZendTo at zend.to
> http://jul.es/mailman/listinfo/zendto

Jules

-- 
Julian Field MEng CEng CITP MBCS MIEEE MACM

'If I were a Brazilian without land or money or the means to feed
  my children, I would be burning the rain forest too.' - Sting

www.Zend.To
Twitter: @JulesFM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jul.es/pipermail/zendto/attachments/20230825/f2819614/attachment.html>


More information about the ZendTo mailing list