homepage Welcome to WebmasterWorld Guest from 54.242.126.126
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
PHP Mail configuration
dbarasuk

5+ Year Member



 
Msg#: 4529562 posted 7:26 am on Dec 19, 2012 (gmt 0)

Hi,
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.

 

coopster

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



 
Msg#: 4529562 posted 11:35 pm on Dec 28, 2012 (gmt 0)

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:

[php.net...]

dmorison

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4529562 posted 7:51 pm on Dec 31, 2012 (gmt 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);

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved