Email a friend does not send mails with Amazon SMTP

If you have installed Aschroder SMTP module and happen to have an Amazon SMTP server and you’ve noticed that only email a friend does not send mail then the problem is with the SMTP server. If you check your error log you might notice an error like “Message rejected: Email address is not verified.” The solution is to localize in app/code/local/Mage/Sendfriend/Model/Sendfriend.php or overwrite in a custom module the model Mage_Sendfriend_Model_Sendfriend editing it in the following way: go to send() function and comment out

$sender  = array(
            'name'  => $this->_getHelper()->htmlEscape($this->getSender()->getName()),
            'email' => $this->_getHelper()->htmlEscape($this->getSender()->getEmail())

and add instead of it

 $sender  = array(
            'name'  => Mage::getStoreConfig('general/store_information/name'),
            'email' => Mage::getStoreConfig('trans_email/ident_general/email');
// in the message you can speicify the actual sender
$message=$message."<br/> Message sent by: ".$this->getSender()->getName()." ".$this->getSender()->getEmail();

In this case the sender is Mage::getStoreConfig(‘trans_email/ident_general/email’) is the site general contact mail which you can replace with any other config mail. I suppose the mail has the same domain as your site. Now the amazon server will let you mail to friends because the sender domain is your one!

For the novice: Mage_Sendfriend_Model_Sendfriend you can find in app/code/core/Mage/Sendfriend/Model

This entry was posted in Errors, Uncategorized and tagged , . Bookmark the permalink.

6 Responses to Email a friend does not send mails with Amazon SMTP

  1. Joel says:

    Hello Erik,

    I have exactly the same issue all my notifications works except those related email send to friend or share wishlist. So I proceeded with your instruction but unfortunately it still not working (I am using Magento CE 1.8.1).
    Please let me know if I did anything wrong in the change:

    public function send()
    if ($this->isExceedLimit()){
    Mage::throwException(Mage::helper(‘sendfriend’)->__(‘You have exceeded limit of %d sends in an hour’, $this->getMaxSendsToFriend()));

    /* @var $translate Mage_Core_Model_Translate */
    $translate = Mage::getSingleton(‘core/translate’);

    /* @var $mailTemplate Mage_Core_Model_Email_Template */
    $mailTemplate = Mage::getModel(‘core/email_template’);

    $message = $message.”Message sent by: “.$this->getSender()->getName().” “.$this->getSender()->getEmail();
    $sender = array(
    ‘name’ => Mage::getStoreConfig(‘general/store_information/name’),
    ‘email’ => Mage::getStoreConfig(‘trans_email/ident_general/email’)

    Thank you for your response,

    Best regards,


    • erik says:

      Hello Joel!

      Have you ensured that the contact mail is of the same domain like your website?
      Have you managed to send test mail with your smtp?
      Did the sending run without throwing an error?

  2. Joel says:

    Hello Erik,

    Thank you for this fast response, can you tell me how can I check that “the contact email is the same domain like” my website?

    For all my verified emails I have done the test my AMAZON SES SMTP and all are working and no error message.

    Beside on my website when I send a product mail to friend I have a successful message that confirmed that the email was sent despite it was not the case.

    Thank you for response,

    Best regards,


    • erik says:

      Hello Joel!

      Store general contact mail field can be found in admin in SYSTEM -> CONFIGURATION -> GENERAL tab (it’s the first menu block on the left) -> Store email addresses -> General contact

      You’ll find there the mail field.

  3. Joel says:

    Dear Erick,

    Yes my emails fields are filled for the first one for instance with:
    Sender name: editor
    Sender email:
    But what should I check with the code modification you’ve provided?

    Best regards,


Leave a Reply

Your email address will not be published. Required fields are marked *

4 + eight =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>