E-mail could not be sent in Joomla ‘Send to a friend’ popup

I recently had a ‘bug’ in Joomla where I’d get “E-mail could not be sent” when sending an article to a friend. The funny thing was, it had worked and I had mail in my inbox to prove it. I tried all the different mail settings and still had nothing. This was when I stumbled on the fact that to prevent spamming of the form, the page needs to wait for 20 seconds before being sent.

If you want to change this, open up Components > com_mailto > controller.php and right at the top you’ll have:

define('MAILTO_TIMEOUT', 20);

You can change this (but leave your form open to spamming), or alternatively add in a better message to tell the user what is going on:

JError::raiseNotice( 500, JText:: _ ('EMAIL_NOT_SENT' ));

change to

JError::raiseNotice( 500, JText:: _ ('EMAIL_NOT_SENT_SPAMWAIT' ));

and then in your Languages > en_GB > enGB.com_mailto.ini, add in

EMAIL_NOT_SENT_SPAMWAIT=To prevent this form being spammed you need to wait 20 seconds before you submit the form.

2 thoughts on “E-mail could not be sent in Joomla ‘Send to a friend’ popup

Leave a Reply

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