Magento: Email To A Friend Doesn’t Work – Quick Fix

Magento - email to a friendIf you’re running Magento 1.4 (or 1.4.0.1) and your “email to a friend” form doesn’t send emails,  that’s because your Magento template (Magento theme) is not fully compatible with 1.4.

Note that the “email to a friend” form won’t return any error – it just won’t send the email and won’t redirect to the product page like it’s supposed to.

So here’s what you’ll need to do to update your Magento template in order to quickly fix this error:

Open this file:

app/design/frontend/default/themename/template/sendfriend/send.phtml

Find this line:

<form action="<?php echo $this->getUrl('*/*/sendmail', array('id'=>$this->getProductId(), 'cat_id'=>$this->getCategoryId())) ?>" method="post" id="product_sendtofriend_form">

And add the following code below:

<?php echo $this->getBlockHtml('formkey')?>

That’s it!

Related posts:

Don’t forget – subscribe and follow!

Be sure to subscribe to the feed and follow us on Twitter for more tips, resources, and giveaways!

12 Comments

  • Jack Black
    Hello, I tired the quick fix that you recommended and I still cant get the email a friend to work. Do I need to cashe the site out before it works? Would you have any other suggestions to fix this? My site was updated to 1.4.1.0 Stable version. In addition, the wishlist does not work either. Do you have any suggestions as to how I could get that to work also?
    Thanks,
    Jack
  • Hector
    It was so easy and I lost so much time trying to fix it I almost want to cry. Thanks THANKS!
  • Ivan
    That was the solution for me! Thanks a lot!
  • Mayank
    Hi,
    I am new to magento and wanted to know something. After i hit submit for sending mail to friend i want to redirect it back to the products page. In which file i need to do changes.

    Thanks in advance

    Noam -

    This is the file you’ll have to edit:
    app/design/frontend/default/yourthemename/template/sendfriend/send.phtml
  • bhab
    hello there.
    I tried this fix but my “email to friend” still doesn’t work. i am using magento 1.4.1.1. It shows “The link to a friend was sent” message but the email is not sent.
  • Edwin Lam
    Thanks to this great post our problem seems to have been fixed.

    @bhab – try adding a new template for ‘Email to a friend’ under Admin > System > Transactional Emails > Add New Template. Use ‘Load Template’. And don’t forget to go to Admin > System > Configuration > Email to a friend > Select Email Template to select it. Your problem may have to do with a pre-1.4.x theme used with magento 1.4.1.1, thus the templates not compatible? Hope this helps.

    Happy Magento’ing
    Edwin

    Jabez Networks, Inc.
    Magento E-commerce, SEO, China Marketing.

  • Jurij
    Thanx a lot.
  • Dj004
    Hi,

    After reading through the posts above of which I have tried I still cannot send any thing to a friend.
    All i seem to get is
    ” The messages cannot be sent more than 10 times in an hour ”

    I have changed the config and made a new email template and changed the code but still nothing.

    I a am a newbie to magento and web design does anyone have any ideas where i go from here.

    Thanks

  • Harita Soni
    great!!!…worked perfectly for me…. thanks a lot….
  • Ivan Novak
    This worked for me. Thanks!
  • Mohanraj Thangarasu
    thanks for your wonderful code. it worked like charm.

Leave a Reply

Sorry - this blog is now closed to new comments.