Jump to content

[SOLVED] PHP script help...


php-noobie

Recommended Posts

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_email\nPhone Number: $sender_phone\nMessage: $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 :)

 

Link to comment
https://forums.phpfreaks.com/topic/43026-solved-php-script-help/
Share on other sites

I'm not sure what you are trying to do. Why wouldn't the code you already have not work?

 

Note: Use the

-tag for your code snippets another time  Example:
[code]code here

 

Thanks for the reply and the 'code' tip :)

 

The code I was using used to work fine but then freeola (the hosts) decided that no anonymous mail would be handled by their servers in an attempt to battle spammers...so they said that the from email address on the mail php scripts would have to be a freeola hosted address.

 

Hope that makes sense.

Thanks for all the suggestions guys but I have managed to get the problem solved with the reluctant help from the hosting company.  I think they received a lot of complaints so they sent an email to all their customers notifying them that people who use custom scripts will need to add a -f parameter for their scripts to work.  As soon as I did that, normal service was resumed.  Yippee!!

 

Here's the script now in case it helps anyone else (have removed the email address):

 

<?
$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_email\nPhone Number: $sender_phone\nMessage: $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.";

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.