Sending HTML formatted email via email plugin

pundip

Member
I have an application where I have a form which I want to use to send templated emails. I have a cascading dropdown which pulls the email template from another list depending on the dropdown value. The template is a formatted HTML template (created and stored using field element). However when I call it into a cascading dropdown element it is no longer formatted html and the email just sends it as text. Is there a way to send this as html? Do I need to copy it to a field element with a WYSIWYG editor or is there a setting I have over looked.
 
You can use the Joomla mailer to send an HTML email out of a form submit event like (onAfterProcess):

Code:
   // now notify the selected administrators via email
   $mailer = JFactory::getMailer();
   $config = JFactory::getConfig();
   $sender = array($config->get('mailfrom'), $config->get('fromname'));
   $mailer->setSender($sender);
   $mailer->addRecipient($emailArray);
   $mailer->setSubject('{$jConfig_sitename} Notification: Here's what new...');
   $mailer->isHtml(true);
   $mailer->Encoding = 'base64';

   $body = '<h2>User {$my->name} [{$my->username}] submitted a subscription request for</h2><p>'
          . 'Company name  : <b> ' . $foo->companyName. '</b><p>'
          . 'Users email   : <b>{$my->email}</b><p>'
          . 'Telephone     :<b> ' . $foo->telephone . '</b><p>'

          . 'Customer id   :<b> ' . $data['mylist___customer_id']   . '</b><p>'
          . 'Notes         :<b> ' . $data['mylist___customer_notes']   . '</b><p>'
          . '<b>Some other text/b><p>'
          . '<h1><p>Something in H1</p></h1>';
 
   $mailer->setBody($body);
   $send = $mailer->Send();
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top