What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Help with PHP mail() function... how to configure the server?

Help with PHP mail() function... how to configure the server?
Author: Message:
Choli
Elite Member
*****

Avatar
Choli

Posts: 4714
Reputation: 42
43 / Male / Flag
Joined: Jan 2003
O.P. Help with PHP mail() function... how to configure the server?
Hi,

I'm trying to use the mail function of PHP but it doesn't seem to work in my server. Let me explain that:

I wrote this code:
code:
$dst = "someone@example.net";
$subject = "test";
$msg = "bla bla bla...";
$hdr = "From: someoneelse@example.com\r\nReply-To: someoneelse@example.com\r\nX-Mailer: PHP";

$ret = mail($dst, $subject, $msg, $hdr);

Some time ago I tested that code in a public server (one of those sites where you pay for a hosting and everything is installed (apache, php, ...)) and it worked correctly. The mail was sent to someone@example.net with the sender someoneelse@example.com.

Now, I want to set up my own server. It's a Linux (Ubuntu 6) machine with Apache 2 and PHP 5. As it says in www.php.net I've also installed sendmail. So in this machine, the code above does not work. The mail() function returns true, but the mail isn't sent.

I've been investigating a bit and I've discovered that mail() calls sendmail (as expected) but sendmail can't send the message. I think that sendmail tries to open a socket to localhost:25 (where there's another sendmail process listening to) but at the end, the message is not sent.

I've tried to modify php.ini without any luck. Also, I don't know how to configure sendmail properly. Any help with this, please?

In my tests, I've deduced that either PHP should connect to example.net:25 to send the email, or the sendmail daemon (the one listening to localhost:25) should do that, but none of those things happens.

So, what can I do?

Thanks for the help. (if you need any more details, just ask me ;))
Messenger Plus! en espaņol:
<< http://www.msgpluslive.es/ >>
<< http://foro.msgpluslive.es/ >>
:plus4:
10-12-2007 06:20 PM
Profile PM Find Quote Report
scott2010_h
Full Member
***

Avatar

Posts: 187
Reputation: 10
32 / Male / Flag
Joined: Dec 2005
Status: Away
RE: Help with PHP mail() function... how to configure the server?
I've never used sendmail before but I have use the guide below for setting Postfix up

http://mysql-apache-php.com/#mailserver

I had it setup in under a 30 minutes.

P.S. If you need help setting up Postfix I can try to help you.
10-13-2007 02:58 AM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On