Jump to content


Function mail()

  • Please log in to reply
1 reply to this topic

#1 Mehdi

  • Members
  • PipPip
  • Member
  • 12 posts

Posted 21 October 2006 - 11:29 AM


The next script cann't send a message to a mail addresse by "Yahoo" (someone@yahoo.com) but wel to a mail addresse by google (someone@gmail.com).

<title>Exercise 14.2</title>

<form method="post" action="<?=$_SERVER['PHP_SELF']?>">
Insert your mail address: <input type="text" name="mail">
Insert the subject: <input name="subject" type="text">
<textarea name="message" row="50px" col="70px">
<input type="submit" value="Submit">

if (!empty($from) && !empty($subject) && !empty($message)){
 mail($to, $subject, $message, "From: $from\r\n") or die("Couldn't send mail");
 print "Browser: ".$_SERVER['HTTP_USER_AGENT']."<br>IP address: ".$_SERVER['REMOTE_ADDR'];
else {
 print "You haven't filled in the form completely!";

Could you help me please?


#2 obsidian

  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 21 October 2006 - 12:38 PM

if your script sends to anyone at all, the issue is not in your script. the problem is that yahoo has built-in spam block that checks for certain header information and other things that are not in a server-sent email by default. you'll need to do some googling on how to bypass yahoo spam block with PHP sent emails. it may help some just to have your From and Reply-To headers both match:
$to   = "me@yahoo.com";
$from = "webmaster@mysite.com";
$sub  = "Testing Yahoo";
$msg  = "Did it go through???";
$head = "From: Webmaster <$from>\r\nReply-To: $from";
mail($to, $sub, $msg, $headers);

good luck!
You can't win, you can't lose, you can't break even... you can't even get out of the game.

while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users