php-noobie Posted March 16, 2007 Share Posted March 16, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/43026-solved-php-script-help/ Share on other sites More sharing options...
Daniel0 Posted March 16, 2007 Share Posted March 16, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/43026-solved-php-script-help/#findComment-208984 Share on other sites More sharing options...
shaunrigby Posted March 16, 2007 Share Posted March 16, 2007 Your script probably wnt work, because you have no headers, see here for some info; http://www.htmlite.com/php029.php Quote Link to comment https://forums.phpfreaks.com/topic/43026-solved-php-script-help/#findComment-209018 Share on other sites More sharing options...
php-noobie Posted March 16, 2007 Author Share Posted March 16, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/43026-solved-php-script-help/#findComment-209075 Share on other sites More sharing options...
shaunrigby Posted March 16, 2007 Share Posted March 16, 2007 $headers = "From: Name <Freeola Email Address>"; $headers .= "Reply-Path: Name <Reply email address>"; mail($to, $subject, $message, $headers); www.php.net search for mail for more accurate help with the mail() function Quote Link to comment https://forums.phpfreaks.com/topic/43026-solved-php-script-help/#findComment-209085 Share on other sites More sharing options...
per1os Posted March 16, 2007 Share Posted March 16, 2007 A correction to the above $headers = "From: Name <Freeola Email Address>\r\n"; $headers .= "Reply-Path: Name <Reply email address>"; mail($to, $subject, $message, $headers); You should always use \r\n on headers that are not the final one. Quote Link to comment https://forums.phpfreaks.com/topic/43026-solved-php-script-help/#findComment-209090 Share on other sites More sharing options...
shaunrigby Posted March 16, 2007 Share Posted March 16, 2007 yea forgot to put that, cheers frost110 Quote Link to comment https://forums.phpfreaks.com/topic/43026-solved-php-script-help/#findComment-209111 Share on other sites More sharing options...
php-noobie Posted March 19, 2007 Author Share Posted March 19, 2007 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."; ?> Quote Link to comment https://forums.phpfreaks.com/topic/43026-solved-php-script-help/#findComment-210724 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.