I've got a form that allows users to send an article to friends. The friends are set in a $recipient array. I can dump the array and it looks fine:

// array (size=2)
0 => [email protected]
1 => [email protected]

So far so good. Then the array is added to the $mail object:

$mail = JFactory::getMailer();

I am using mailtrap.io to track the mailing and test where they are sent. The second email (to [email protected]) never gets sent. The first one does. So I have to assume there's a problem with how Joomla is handling the array of recipients. This is Joomla 3.3.6

Any ideas?

  • 1
    Have you var_dumped the object after you added the recipients to verify they've been added? I took a look at the JMail class and there's logic to handle arrays. There's another entry point, perhaps manually looping through and using $mail->add($recipient) could be a workaround. Commented Oct 22, 2014 at 23:29

1 Answer 1


Here is a hypothesis based on what I seen in the source code.

I don't see anything that looks like there is any problem with adding the recipient. Are you using SMTP? With SMTP you can use the variable $mail->SMTPDebug = true This should echo the request if made via SMTP.

Either way PHPMailer (what joomla uses) loops through the recipients and sends them an email each, if there is any kind of limiter in the PHP mail settings or SMTP server settings that could be the reason. You could try adding them as a CC though if that is an option.

If this is the case you could try mandrill http://mandrill.com/. It has a very nice SMTP service and is free up to 12000 emails (a month). But, with some hosts SMTP requests tend to be blacklisted. So again mandrill is a reasonable idea as it comes with an http API. There is also an extension that overrides JMail to us it. https://compojoom.com/joomla-extensions/mandrill-transactional-emails-made-easy

We use this heavily and since doing so we have had little to no problems with emails. It is all free too until you reach a certain threshold that is difficult to reach.

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.