Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

mail not being sent !!!!!

the mail() function

Moderators: macek, egami, gesf

mail not being sent !!!!!

Postby wckf » Fri Mar 29, 2013 6:00 am


if (isset($_POST["from"]) && isset($_POST["to"]) && isset($_POST["subject"]) && isset($_POST["message"]) )
$from = $_POST["from"] ;
$to = $_POST["to"];
$subject = $_POST["subject"] ;
$message = $_POST["message"] ;
$header = $from; }
ini_set ("SMTP", "");

$sendmail = mail($to, $subject, $message, $header) ;
if($sendmail == true){ echo 'mail sent';}
else {echo "please try again";}


when i send it it gives me e-mail sent but when i go to my email to check it is not their i check inbox and junk it is not in either !
New php-forum User
New php-forum User
Posts: 15
Joined: Wed Mar 27, 2013 7:59 am

Re: mail not being sent !!!!!

Postby egami » Fri Mar 29, 2013 8:18 am

$from = $_POST['from'];
$header = $from;

This is probably your problem.

$header should look something similar to:

$header = "FROM: \r\n";

So, to make your script work.. something like..

$header = "FROM: $from \r\n";

Give that a shot.
User avatar
php-forum GURU
php-forum GURU
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Return to PHP coding => Mail

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.