Forum Moderators: coopster

Message Too Old, No Replies

Mail PHP not working help please

php email not working

         

mranderson

9:28 pm on Dec 4, 2008 (gmt 0)

10+ Year Member



Hello I'm hoping someone on here can help me out with this code. It does not work at all but I can't figure out why.
here is the code

<?php

$sitename = 'whatever';
$oururl = 'http://whatever.com';
$mailto = 'sdfsdf@whatever.com';

$subject = $_POST['subject'] ;
$thankyou = "Your Email to $sitename Has Been Received" ;

$formurl = "$oururl" ;
$errorurl = "$oururl/error.html" ;
$thankyouurl = "$oururl/thankyou.html" ;

$name = $_POST['name'] ;
$phone = $_POST['phone'] ;
$email = $_POST['email'] ;
$message = $_POST['message'] ;
$ip = $_POST['ip'];
$http_referrer = getenv( "HTTP_REFERER" );
$response = "$email" ;
if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (empty($email) ¦¦ empty($phone)) {

header( "Location: $errorurl" );
exit ;
}
$name = strtok( $name, "\r\n" );
$email = strtok( $email, "\r\n" );
if (get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
}

$messageproper =

"Referred by: $http_referrer\n\n" .

"Name: $name\n" .
"Phone: $phone\n" .
"Message: $message\n" .

"----------------------- Question/Comment ----------------------\n\n" .
"$message" .
"\n\n------------------------------------------------------------\n" ;

$messageresponse =

"Dear $name:\n\n" .

"Your Email to $sitename has been received. " .
"We will be in contact with you soon." .
"\n\n" .
"Best Regards,\n" .
"$sitename\n" .

"\n\n\n" .
"*We respect your privacy, and you can rest assured that the confidentiality of your information, including your email-address, will never be sold or shared with any outside marketers." .
"$ouraddress\n" ;

//Receiver(s)
mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>\r\nReply-To: \"$name\" <$email>\r\n X-Mailer: PHP/" . phpversion());
mail($mailto2, $subject, $messageproper, "From: \"$name\" <$email>\r\nReply-To: \"$name\" <$email>\r\n X-Mailer: PHP/" . phpversion());

//Response to Submitter
mail($response, $thankyou, $messageresponse, "From: \"$sitename\" <$mailto>\r\nReply-To: \"Contact $sitename\" <$mailto>\r\n X-Mailer: PHP/" . phpversion());
header( "Location: $thankyouurl" );
exit ;
?>

mranderson

11:06 pm on Dec 4, 2008 (gmt 0)

10+ Year Member



any suggestions?

eelixduppy

11:44 pm on Dec 4, 2008 (gmt 0)



Welcome to WebmasterWorld!

Are you getting any errors from your script? In the browser or in your error logs?

dreamcatcher

12:06 am on Dec 5, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Set your error reporting to show all errors:

<?php
error_reporting(E_ALL);
$sitename = 'whatever';
....
?>

See if that shows the problem when you run the code.

dc

mranderson

5:18 pm on Dec 5, 2008 (gmt 0)

10+ Year Member



Thank you for your response. Oddly no, no error logs.

mranderson

5:20 pm on Dec 5, 2008 (gmt 0)

10+ Year Member



I just saw your post dreamcatcher. I will apply that code and see what happens. Thanks.

ali91

8:25 pm on Dec 10, 2008 (gmt 0)

10+ Year Member



well man i recommend you try to e-mail to different e-mail provider like gmail or hotmail
or the problem with your hosting server
thnx