sending mail

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
udara77
Forum Newbie
Posts: 1
Joined: Thu Apr 09, 2009 3:32 am

sending mail

Post by udara77 »

i sent a email using the following cord.


<?php
$to=$_POST["to"];//to=udara99@gmail.com
$from=$_POST["from"];//from=udara77@yahoo.com
$subject=$_POST["sub"];
$message=$_POST["msg"];
$headers="from: " .$from ."\r\n";
$mailsent=mail($to,$subject,$message,$headers);
if($mailsent){
echo "Congratulation the mail has been sent<br>";
echo "<b>To :<b> $to<br>";
echo "<b>From :<b> $from<br>";
echo "<b>Subject :<b> $subject<br>";
echo("<b>message :<b> <br>");
echo("$message");
}else
echo("the mail not sent");
?>
this code output in a way that email has been sent,but actually it has not been sent.
im using localhost.

dont know y>
corkman
Forum Newbie
Posts: 14
Joined: Thu Apr 09, 2009 3:40 am

Re: sending mail

Post by corkman »

It looks fine. My best guess is that mail is really sent, but it ends somewhere along with the spam messages (look into spam folder on yahoo). When you are sending using mail() function, be sure to define all the significant headers (at least from, to, subject, date), this increases the chance your message will pass the mail filters.
Post Reply