You are here: Re: Sample "Email Feedback Form" in PHP « All PHP « IT news, forums, messages
Re: Sample "Email Feedback Form" in PHP

Posted by gerg on 12/21/05 16:49

number1.email@gmail.com wrote:
> I've investigated a bit further, and have tried the following code:
>
> FileName: index2.php
> ---------------------------------
>
> <?
> mail( "abc@yahoo.com", "A", "B", "From: abc@aol.com" );
> echo "Finished Emailing.";
> ?>
>
> For some reason I don't get an email in my abc@yahoo.com account, but
> the message "Finished Emailing" does display. Seems pretty
> simple...but it doesn't work. Can someone help me figure out what is
> wrong...or the best way to debug this? thanks...
>

ok this should work:

file with form is fine.

the mailing file(change all header URLs to match your site and files:

<?

/* check to make sure post data exists, if not, redirect, this will keep
people from submitting blank forms, or try to access your mailing file
directly.*/

if( (empty($_POST['email'])) || (empty($_POST['message'])) ){
header("Location:http://www.yoursitesloginform.com/");
exit();
}

$email=$_POST['email'];
$msg=$_POST['message'];
$to="youremail@yourdomain.com";
$re="My Feedback Form";
$headers ="From: somerandomemail@yourdomain.com";

mail($to, $re, $msg, $headers);

header("Location:http://www.yourdomain.com/thankyou.html");
exit();

?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация