Sending external form as html instead of plaintext (setAdditionalHeaders for adding header item to external form)
Permalink
I found setAdditinoalHeaders in the API, but I'm unsure how to pass it the data it needs.
I need to add a new header type so I can include HTML in the email that gets delivered:
The header I would like to add is:
"Content-Type: text/html; charset=ISO-8859-1\r\n";
The mail API is here:
http://documentation.concrete5.org/api/class-Concrete.Core.Mail.Ser...
If I pass new headers via:
how do I pass the above header this way?
I need to add a new header type so I can include HTML in the email that gets delivered:
The header I would like to add is:
"Content-Type: text/html; charset=ISO-8859-1\r\n";
The mail API is here:
http://documentation.concrete5.org/api/class-Concrete.Core.Mail.Ser...
If I pass new headers via:
setAdditionalHeaders( array $headers, string $val,… )
how do I pass the above header this way?
Scratch my above answer, that is for adding additional headers not normally present in an email sent from website.
The built in mailer service already contains the functionality to send email as HTML instead of plainText, and its very simple:
Instead of using
when sending the mail, use the setBodyHTML method instead:
The built in mailer service already contains the functionality to send email as HTML instead of plainText, and its very simple:
Instead of using
$mail->setBody($body);
when sending the mail, use the setBodyHTML method instead:
$mail->setBodyHTML($body);
Which works, my only problem is, now I have Content-Type set twice in the email coming in. It still renders the HTML, but the message header has two content types, not sure if thats ok or not...
In the incoming email:
Is it ok to have double content types like this? It does seem load the html. But is there a better way?