PHP Form mailer problem Please help a Noob
Posted: Sat Apr 05, 2008 4:56 pm
Hello Everyone,
I have created a PHP mailer following a tutorial I found online. I know very little about coding, BUT I did get this exact code to work on a friends site, who is hosted by "Go Daddy". This code below is identical except for the e-mail addresses, but will not send any e-mails with my hosing provider. They did say they had three requirements that was their most common source for problems.
1. Must be a paid hosting account, Which I have.
2. Header must be complete, to, from, subject. Which I think I have done.
3. One of the two e-mail addresses must be hosted on their server. The address listed is.
Here is the script I used.
This did not work. The html portion can be viewed at holisticarts.net on the contact page.
Then I tried a test script provided my the hosing company. It is listed below.
This is what is loaded on the server now as mailer.php, it also does not work. I get the "MAIL - OK" after filling out the form, so I think the html is correctly referencing the PHP file, but I do not know where to turn from here. Sorry for the lengthy post, but I wanted to be as specific as I could.
Thanks for your time in advance,
Victor
I have created a PHP mailer following a tutorial I found online. I know very little about coding, BUT I did get this exact code to work on a friends site, who is hosted by "Go Daddy". This code below is identical except for the e-mail addresses, but will not send any e-mails with my hosing provider. They did say they had three requirements that was their most common source for problems.
1. Must be a paid hosting account, Which I have.
2. Header must be complete, to, from, subject. Which I think I have done.
3. One of the two e-mail addresses must be hosted on their server. The address listed is.
Here is the script I used.
Code: Select all
<?PHP
$to = "holisticarts@yahoo.com";
$from = "christie@holisticarts.net";
$subject = "Holistic Arts Info Request";
$forward = 0;
$location = "";
$date = date ("l, F jS, Y");
$time = date ("h:i A");
$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";
if ($_SERVER['REQUEST_METHOD'] == "POST") {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
mail($to, $from, $subject, $msg);
if ($forward == 1) {
header ("Location:$location");
}
else {
echo "Thank you for contacting us. We will get back to you as soon as possible. Namaste.";
}
?>Then I tried a test script provided my the hosing company. It is listed below.
Code: Select all
<?
$from = "Holistic Arts";
$to = "christie@holisticarts.net";
$subject = "Hi 2 ";
$body = "TEST Vic";
if(mail($to,$subject,$body,$from)) echo "MAIL - OK";
else echo "MAIL FAILED";
?>Thanks for your time in advance,
Victor