I am using Zend\Mail\Message to send an emails.Need to add some custom headers to mail but Mail\Message don't have addHeader() function.I am using Zend Framework 2.Is there any other function which can be used to add custom headers to mails.I had referred link in documentation.But I can not find addHeader in Mail\Message. zend-mail version is 2.10.0
How to add custom header to zend Mail\Message
527 views Asked by Yogesh At
2
There are 2 answers
0
On
Issue with following is it append <=?UTF-8?Q?$header?=>: to value
$this->getHeaders()->addHeader($header) but I was needing plain headers.
I had created Custom class which extends the \Zend\Mail\Header\HeaderInterface
And overwrite public static function fromString function. Passed the header as follows
$customHeader = CustomHeaderClass::fromString($header);
$this->getHeaders()->addHeader($customHeader);
According to the documentation you should consider to use the headers like this :
Full documentation is found here