Hello super joomlers!
By default, you can only send and email in text only or html only with JMail api in Joomla! 3.
But with this code snippet, you can send both, html and text email at the same time.
This is useful to improve your score and find your email less and less in your customers spams mailbox.
Here is the code.
I stumbled upon this problem. Here is what worked for me:
$mailer = JFactory::getMailer();
$mailer->CharSet = 'UTF-8';
$mailer->Encoding = 'base64';
$mailer->AltBody = $alt_body;
$send = $mailer->Send();
The key point is here:
$mailer->AltBody = 'Your text version of the email here';
This text message will be sent with the html counterpart and for users that do not wish to see the html version or cannot see it, they will see this text version.
Tested on Joomla 3.7.5 Hope it helps someone. Happy coding!
#Joomla technical problem solver.
Focusing on secure coding and defensive cybersecurity
#appsec #blueteam.#coderparlerpartager Now working @aproximito.
Privacy and Cookies policy
Subscribe to my newsletter
Listen to my podcast
Also on Youtube