PHP script help...

Hi…

not sure if this is the right place to post but I would appreciate some help please.

I have a website hosted at freeola and they have just changed their requirements to use their mail form php script…only mail which is shown to come from a valid email address hosted by freeola will work from any contact forms.

Here is my sendmail.php script which used to work ok before they made their changes (I have changed the to email address for obvious reasons):


<? $sender_address = $_POST['sender_address']; $sender_email = $_POST['sender_email']; $sender_phone = $_POST['sender_phone']; $sender_message= $_POST['sender_message']; $sender_name= $_POST['sender_name']; $ToEmail = "[email protected]"; $ToName = "Nick"; $ToSubject = "$sender_address"; $EmailBody = "$sender_name has sent you a message from your website nEmail: $sender_emailnPhone Number: $sender_phonenMessage: $sender_message"; $EmailFooter="n"; mail($ToName." <".$ToEmail.">",$ToSubject, $EmailBody, "From: ".$sender_name." <".$sender_email.">"); Print "_root.pages.EmailStatus= Message sent successfully."; ?>

I’m unsure as to what exactly needs changing and they do not offer php support so they cannot help me. I thought I needed to edit the following line:

$sender_email = $_POST[‘sender_email’];

So it looks like (obviously the email address is an example only):

$sender_email = $_POST[‘[email protected]’];

However, I have tried that but mail still does not come through.

Is anyone able to give me some advice please?

The Contact Form is at:
http://www.nick-thompson.co.uk

Thank you :)

Perhaps your hosting provider blocked the mail functionality for custom scripts?

Thank you for the reply…I have managed to fix the problem with the ‘reluctant’ help from the hosting company…needed to add a -f parameter and all is working as it should now:

[code]<?
$sender_address = $_POST[‘sender_address’];
$sender_email = $_POST[‘sender_email’];
$sender_phone = $_POST[‘sender_phone’];
$sender_message= $_POST[‘sender_message’];
$sender_name= $_POST[‘sender_name’];

$ToEmail = “freeola.hosted.email.adress”;

$ToName = “Nick”;
$ToSubject = “$sender_address”;

$EmailBody = “$sender_name has sent you a message from your website nEmail: $sender_emailnPhone Number: $sender_phonenMessage: $sender_message”;

$EmailFooter=“n”;

mail($ToName." <".$ToEmail.">",$ToSubject, $EmailBody, “From: “.$sender_name.” <”.$sender_email.">", '-f freeola.hosted.email.adress);

Print “_root.pages.EmailStatus= Message sent successfully.”;

?>[/code]

Thanks again for taking the time to reply :D

Sponsor our Newsletter | Privacy Policy | Terms of Service