Sending Mail with php on linux

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
hward
Forum Contributor
Posts: 107
Joined: Mon Apr 19, 2004 6:19 pm

Sending Mail with php on linux

Post 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?
DrHoliday
Forum Newbie
Posts: 11
Joined: Mon Dec 06, 2004 5:12 pm
Location: Germany

Post 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
Post Reply