$mail->send ignores $fromEmail (bug?)

Chris D

XenForo developer
Staff member
Ok, so I have an add-on which sends an e-mail.

Overall, this is working perfectly. The e-mail is sent using the correct template, it is sent to the right person, it is sent from the default name and e-mail address for the board.

It is the latter I would like to change.

So... I have:

$options = XenForo_Application::get('options');
$fromEmail = $options->fromEmail;
$mail = new XenForo_Mail('my_email_template', $params, $visitor['language_id']);
$mail->send($toEmail, $toName, $headers = array(), $fromEmail);
If I echo $fromEmail then the correct address as defined in Admin CP options is returned, yet when the e-mail is sent the from email address is simply the board default.

This could well be a bug - if it is feel free to move it to Bug Reports - though probably more likely is I've missed something :unsure:

Thanks guys (y)

Mr. Goodie2Shoes

Well-known member
okay... I just checked XF's Mail class I couldn't find any error in the code... XF will use it's default mail if the $fromEmail var is empty... :rolleyes: