5

I built a custom component using the $mail = JFactory::getMailer(); as shown on this page: https://docs.joomla.org/Sending_email_from_extensions.

I'm using mailtrap.io to catch the sent mail for testing.

It worked fine for all the Joomla 3.4 releases until 3.4.3, at which point it no longer works. The mail still gets sent, but unless I set the $mail->isHTML(true); flag, there's no body content in the message (subject, reply to, etc. still gets through fine).

If I var_dump the $mail variable, the $body content appears correct-- it's not that the variable isn't being set. It seems like it's just not making it out the door.

Has anyone run into this?

2
  • I was reading through the Joomla commits recently and if I remember correctly, PHPMailer was updated. Perhaps this update is the cause. I might run a test today
    – Lodder
    Aug 19, 2015 at 7:32
  • Use a diff to check changes in Mailer classes. It is possible it is framework related. Aug 22, 2015 at 12:57

1 Answer 1

1

I have tested the case on sendgrid. It works OK with text or html mails.

    $mailer = JFactory::getMailer();
    $config = JFactory::getConfig();
    $sender = array(
            $config->get($this->get('mail_sender_email')),
            $config->get($this->get('mail_sender_name'))
    );
    $mailer->setSender($sender);        
    $mailer->isHtml(false); // Or, true
    $mailer->SetFrom($sender_mail, $sender_name);
    $mailer->AddAddress($recipient_mail);
    $mailer->Subject = 'A Subject';
    $mailer->Body = '<p>Body</p>';
    $mailer->Send();

I guess you should have some incompatibility with mailtrap.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.