Mail From [email protected]

liunx

Guest
I recently modified a (php) calendar script to notify admin (me) whenever a registered user posts an event. I simply added:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><?php<br /><br />  mail( "[email protected]", "Event $month / $day / $year",<br />        $text, $title );<br />?><!--c2--></div><!--ec2--><br /><br />and I get the information. Problem is it comes from <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->. Ok, Nobody owns the script right?<br /><br />So how can I get the email to be sent from the site? Spam filters go crazy with mail from Nobody. Probably an easy fix but I'm just not seeing it. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/huh.gif" style="vertical-align:middle" emoid=":huh:" border="0" alt="huh.gif" /> <br /><br />Thanks for any input, it's always appreciated.<br /><br />Ty<!--content-->
<a href="http://us.php.net/manual/en/function.mail.php" target="_blank">http://us.php.net/manual/en/function.mail.php</a><br /><br />What you want would be part of the header. Take a look at Example #2 on that page. It should be helpful.<!--content-->
Example 3 on the link Jeren gave should also help<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><?php<br />  mail( "[email protected]", "Event $month / $day / $year", $text, $title, "[email protected]");<br />?><!--c2--></div><!--ec2--><!--content-->
Thanks guys, much appreciated. #3 gave the right 'from' address but kept sending as Nobody <[email protected]> so I ended up with:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><?php<br />$to      = '[email protected]';<br />$subject = "Event Added $month / $day / $year";<br />$message = "$title\n\n $text";<br />$headers = 'From: <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->' . "\r\n" .<br />    'Reply-To: <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->' . "\r\n" .<br />    'X-Mailer: PHP/' . phpversion();<br /><br />mail($to, $subject, $message, $headers);<br />?><!--c2--></div><!--ec2--><br /><br />which sends to the right address with no name attached, which is fine!<br /><br />Thanks again. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
Change the mail line to add a from of your choosing.<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->mail($to, $subject, $message, $headers "-f"[email protected])<!--c2--></div><!--ec2--><!--content-->
I'm glad to have been of some help. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /><!--content-->
 
Top