I want to send extra parameter to mail function in magento. I didn't find any raw mail function in magento, can any one help me where I will get that function.

mail($to, $subject, $message, $headers, '[email protected]'); // I want to pass 5th parameter

2 Answers 2


If you magento is using sendmail to send an email, you can find the mail() function in Zend_Mail_Transport_Sendmail. Check the method public function _sendMail().

You can find this file in lib/Zend/Mail/Transport/Sendmail.php of your magento 1 root and vendor/magento/zendframework1/library/Zend/Mail/Transport/Se‌​ndmail.php in your magento2 root. Also it is not recommended to edit this file directly. If you want to modify this, copy this file to app/code/local/Zend/Mail/Transport/Sendmail.php (there won't such directories by default but you can create) and then modify the method _sendMail();

  • Where we can find Zend_Mail_Transport_Sendmail class Commented Oct 7, 2016 at 6:29
  • Updated my answer.
    – Nidheesh
    Commented Oct 7, 2016 at 7:07
  • Thank you!. @Nidheesh. Magento 2 We can find the function here vendor/magento/zendframework1/library/Zend/Mail/Transport/Sendmail.php Commented Oct 7, 2016 at 8:24

The additional_parameters parameter can be used to pass an additional parameter.

mail('[email protected]', 'the subject', 'the message', null,
   '[email protected]');

For more detail additional-parameters

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.