|Making Email a Link to a Friend Work on a Locked Down Server|
|Written by Fr. Robert Bower|
|Wednesday, 21 July 2010 08:43|
Some web hosts have a rule on their mail server that either the To or From email address must reside on the server for the php mail function to send an email from your php mail form. It is a security feature that prevents the email server from being used to send spam.
In theory it is a great idea, however the Joomla's Email a Link to a Friend feature will not work. The email appears to be sent but actually is never sent unless the sender or recipient emails happens to be hosted on the site's email server. The Email a Link to a Friend feature uses the email provided by the person filling out the form as the From email address, so in most cases the email is not sent on a server with the above rule.
The question is how to make the Email a Link to a Friend feature work?
To make the feature work the easiest technique is to have the email sent by an address residing on the server.
The second step is to edit the php script the send the Email a Link to a Friend email to use the newly created email address rather then the form user's email.
The code that runs this feature is found in the following file /components/com_mailto/controller.php
Open the file with an online text editor and find the line
if ( JUtility::sendMail($from, $sender, $email, $subject, $body) !== true )
Change the line to
The recipient will receive an email recommending the page sent by the email address you created and the person who filled out the form will have their name and email address listed in the body of the email.
Make sure you update the code if you update your Joomla site with a new version.
|Last Updated on Thursday, 23 December 2010 08:32|