HELP!! PHP form not sending email
Discussion
Ok, hopefully someone can help.
Here is the code that does the processing of my web form. It maynot be best practice, but it should work! Infact, it has worked but i have fiddled with something and now it does not send any email through to me. It does not error, i get te confirmation that the email was sent on screen but i never actually get the email with the forms contents.
Please help!!
Ian
<?
// Set email variables.
$your_email = "ian.gough@ebiquita.com";
$your_name = "ezine";
$your_link = "http://www.teamwest-tec.com";
$confirm_sub = "Thank you, your details have been processed";
$contact_msg = "$name1, $email, $name2, $title, $address2, $city, $county, $postcode, $country, $dob, $select";
if (!$name2 || !$name1 || !$email || substr_count($email, '@') < 1 ||
substr_count($email, '.') < 1 ) {
echo ('<center>
Error!
<p>
Please go back and correct the errors listed below:
<p>
<ul>');
if (!$name2 || !$name1) {
print "<li>Your name is missing!<br>"; }
if (!$email || substr_count($email, '@') < 1 || substr_count($email, '.') < 1) {
print "<li>Your email is missing or invalid!<br>"; }
echo ('</ul>
<p>
<a href="javascript:history.back()//">Back</a>
</center>');
}
else {
// Email that gets sent to you.
mail( $your_email, "Ezine Subscription", $contact_msg, "From: $name < $email >");
echo("<html>
<Message Sent>
<script>
setTimeout('history.go(-2)', 7000);
</script>
<center>
<b>
Your Message Was Sent.</b></font>
<p>
Thank you ".$name." for joining Team West-Tecs fan club.");
}
?>
Here is the code that does the processing of my web form. It maynot be best practice, but it should work! Infact, it has worked but i have fiddled with something and now it does not send any email through to me. It does not error, i get te confirmation that the email was sent on screen but i never actually get the email with the forms contents.
Please help!!
Ian
<?
// Set email variables.
$your_email = "ian.gough@ebiquita.com";
$your_name = "ezine";
$your_link = "http://www.teamwest-tec.com";
$confirm_sub = "Thank you, your details have been processed";
$contact_msg = "$name1, $email, $name2, $title, $address2, $city, $county, $postcode, $country, $dob, $select";
if (!$name2 || !$name1 || !$email || substr_count($email, '@') < 1 ||
substr_count($email, '.') < 1 ) {
echo ('<center>
Error!
<p>
Please go back and correct the errors listed below:
<p>
<ul>');
if (!$name2 || !$name1) {
print "<li>Your name is missing!<br>"; }
if (!$email || substr_count($email, '@') < 1 || substr_count($email, '.') < 1) {
print "<li>Your email is missing or invalid!<br>"; }
echo ('</ul>
<p>
<a href="javascript:history.back()//">Back</a>
</center>');
}
else {
// Email that gets sent to you.
mail( $your_email, "Ezine Subscription", $contact_msg, "From: $name < $email >");
echo("<html>
<Message Sent>
<script>
setTimeout('history.go(-2)', 7000);
</script>
<center>
<b>
Your Message Was Sent.</b></font>
<p>
Thank you ".$name." for joining Team West-Tecs fan club.");
}
?>
how are you putting the details through? Form?
I'd place bets that global variables have been turned off in a PHP upgrade (they should be for security reasons) hence $email doesn't work, use $_POST['email'] or $_GET['email'] depending on form type.
edit:: for ease, I use this : www.hot-php-scripts.com/php-script/CJ_Web2Mail_-_Simple_web_page_form.htm gives a nice email and is extremely configurable...
>> Edited by docevi1 on Friday 1st July 15:53
I'd place bets that global variables have been turned off in a PHP upgrade (they should be for security reasons) hence $email doesn't work, use $_POST['email'] or $_GET['email'] depending on form type.
edit:: for ease, I use this : www.hot-php-scripts.com/php-script/CJ_Web2Mail_-_Simple_web_page_form.htm gives a nice email and is extremely configurable...
>> Edited by docevi1 on Friday 1st July 15:53
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


