I followed http://docs.joomla.org/Sending_email_from_extensions to send mails via Joomla!.

Now I'd like to send HTML and plain text mails, because not all users want to receive HTML-formatted mails.

But if I set


all mails are sent as HTML.

My question: How can I send mails as html and plaintext with Joomla! ?

  • can you please describe more on the users who want to get html mails and plain mails. So, we could figure out to categorize the users accordingly. – Liz. May 30 '16 at 5:53
  • This would be really interessting. Currently Joomla! only seems to send HTML mails, but what if I have a plain text mail client??? – TIIUNDER Jan 27 '17 at 10:50

I stumbled upon the same problem and here is what I tried and worked for me.

$mailer = JFactory::getMailer();
$mailer->CharSet  = 'UTF-8';
$mailer->Encoding = 'base64';
$mailer->AltBody = $alt_body;
$send = $mailer->Send();

the key point here is

$mailer->AltBody = 'Your alternate text body here';

Which will be sent with the html version of the mail.

Hope it helps. Happy coding!

| improve this answer | |

You need to group users by preferences and depending on it send email with isHtml(true/false)

if you want to include both versions in same email: just include plain text and HTML but mark it up right with MIME standard. Here you can find how to do so http://www.enewsletterpro.com/articles/multi_part_mime_messages.asp

| improve this answer | |

Check out the JoomlaXTC Power Email component and take control over your system emails!

Make your emails give a good impression and raise your brand awareness with attractive HTML styling and custom contents.

Power Mail templates support multiple languages and can be used system wide or for specific components.

Power Mail also allows you to alter specific emails content with your own layout including variable place holders and blind copies.

There is no need to edit cumbersome language files any more. Power Mail supports unlimited templates, unlimited overrides, multiple components, multiple languages and includes 27 built-in template variations to get you started along with a super-fast search tool to find language file constants and strings.

| improve this answer | |
  • 2
    Please read the question before simply suggesting using 3rd party extensions all the time. – Lodder May 27 '16 at 0:03

Your Answer

