Page 1 of 1

Sending Mail with php on linux

Posted: Sat Nov 06, 2004 2:29 am
by hward
I have a server running on Fedora Core and php and mysql on it and thats all i am using. I made a page that sends and email using

Code: Select all

<?php
 $to = "$email" ; 
$subject = "Subject" ; 
$msg = "Message" ; 
mail($to,$subject, $msg) ;
?>
When I first got the page working i sent myself a message and noticed that the from address shows as Apache That got me to thinking back to some stuff I read about reverse DNS and some ips blocking incoming email from your ip if you didn't have a reverse dns setup. I then sent a message to an yahoo account and it didn't show up until the next morning on there so I thought maybe I needed to setup the server with its own mail server to make sure its ip doesn't get black listed or something by other servers for not having something setup properly. If so what all would I need to setup. Sendmail or something?

Posted: Wed Dec 08, 2004 9:05 am
by DrHoliday
You might try faking the "From" and "Sender" mail headers with the parameters 4 & 5 like:

Code: Select all

<?php
$from = "hward@yahoo.com";
$to = $email; 
$subject = "Subject"; 
$msg = "Message"; 
mail($to,$subject, $msg, "From: ".$from, "-f ".$from);
?>
So the receiving server checks your private mail server for reverse dns & stuff, and also will help users reply to a real e-mail address.

Wolfgang