Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP Mail configuration

7:26 am on Dec 19, 2012 (gmt 0)

Full Member

10+ Year Member

joined:Dec 12, 2007
votes: 0

I know this may be a stupid question for those of you who know. I just want to know what configuration I should make in the php.ini ocnfiguration file so I can be able to use the PHP mail function. In my company we have a local mail server (on our LAN) with a fixed IP address (different from the one where PHP is running from) and I wonder if the mail server IP address should be mentioned somewhere in the config file?

Thanks so much for your attention.
11:35 pm on Dec 28, 2012 (gmt 0)


WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
votes: 2

It depends. If there is a sendmail program on your system PHP configure will do its best to determine where it is and use it. Otherwise you can set it explicitly. Have a look at the Installing/Configuring for mail() in the manual pages for more information:

7:51 pm on Dec 31, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 3, 2003
votes: 0

Alternatively the pear/Mail [pear.php.net] library is very easy to use;

$from = "you@example.com";
$to = "them@example.com";
$subject = "Testing";
$body = "Hello";
$smtpinfo = array();
$smtpinfo["host"] = "<ip or host of your LAN mail server>";
$headers = array ('From' => $from,'To' => $to,'Subject' => $subject);
$smtp = &Mail::factory('smtp', $smtpinfo );
$smtp->send($to, $headers, $body);