PHP mail() function + postFix + OpenBSD

Previous thread: Out of Office AutoReply: hi by Warren, Luke on Tuesday, April 24, 2007 - 4:09 am. (1 message)

Next thread: root on raid with external usb disks by Eugene Hercun on Tuesday, April 24, 2007 - 7:33 am. (1 message)
To: <misc@...>
Date: Tuesday, April 24, 2007 - 5:00 am

Hi World,

I've got some questions concerning the using of the mail() php function
under OpenBSD using Postfix as MTA.
Note that I only want to use my OpenBSD Postfix Server as a mail sender
for fogotten password of my web site ^^

First, the "mail" shell command works very well. I receive test mails
from root@myserver.com (using root login) towards
me@anywherebutmyserverevenvirtual.com
Second, the PHP cli (you know under shell) on a php script containing
the mail() php function works very well too (always under root login)

BUT, when i browsing (via FireFox or IE) and I clik on my button "send
my password", nothing happen !! It's like the www users can't use the
/usr/sbin/sendmail...

Note that the script behind the html button is excatly the same I use
with the php line command and that nothing appears in /var/log/messages
or Maillog

Here is versions used:
OPENBSD 3.9
postfix-2.2.8p1 (installed via ports of ftp://bsd)
php-4.0

Here is the Postfix conf:
Stricto "the Postfix instead of Sendmail" tutorial that we can find on
postfix.org, without virtual parameters (not needed here).

Thanks for your reading and your help (since 4 days I'm searching a
solutions...),

GrEg

To: Gregory ESNAUD-FREE <gregory.esnaud@...>
Cc: <misc@...>
Date: Tuesday, April 24, 2007 - 9:35 am

Are you running chroot'd (default)? If so, you need something like
'mini_sendmail', or run Apache 'naked' with a -u.

OR, you could RTFM & Google.

Lee

================================================
Leland V. Lammert lvl@omnitec.net
Chief Scientist Omnitec Corporation
Network/Internet Consultants www.omnitec.net
================================================

To: L. V. Lammert <lvl@...>
Cc: <misc@...>
Date: Tuesday, April 24, 2007 - 10:25 am

Hi all,

Thanks everybody for your help, but still doesn't work...

I tried with femail, then i tried with mini_sendmail (with this:
http://hanz.nl/p/showblog&blog_key=39), and always same result... i.e.
nothing happens...

I'm getting crazy !!

thanks again,
Greg

To: Gregory ESNAUD-FREE <gregory.esnaud@...>
Cc: L. V. Lammert <lvl@...>, <misc@...>
Date: Tuesday, April 24, 2007 - 10:37 am

First make sure mini_sendmail is located in /var/www/bin. Second add or
edit the sendmail_path in your php.ini and restart apache. Make it look
something like this: sendmail_path = "/bin/mini_sendmail -t
-fwww@blahblah.com" where -fwww@blahblah.com is the address you want the
mail to come from. Hope this helps.

To: <misc@...>
Date: Tuesday, April 24, 2007 - 11:02 am

Does php still require a shell to launch femail or mini_sendmail?
This has been discussed in the archives, Greg.

-ME

To: James Turner <james@...>
Cc: <misc@...>
Date: Tuesday, April 24, 2007 - 11:00 am

I was writing my answer when i receive your mail, and that's it...
http://hanz.nl/p/showblog&blog_key=39 told to make a symbolinc link,
that was not working on my server..

anyway, here we are, that's working !

Thanks a lot to everybody !

See you in the tube!
Greg

To: Gregory ESNAUD-FREE <gregory.esnaud@...>
Cc: <misc@...>
Date: Tuesday, April 24, 2007 - 10:25 am

1) Start Apache with -u - if it works, you know it's a chroot problem. If
not, you have something else at play.

2) Check your log files.

3) Check the URLs.

Lee

================================================
Leland V. Lammert lvl@omnitec.net
Chief Scientist Omnitec Corporation
Network/Internet Consultants www.omnitec.net
================================================

To: <gregory.esnaud@...>
Cc: <misc@...>
Date: Tuesday, April 24, 2007 - 5:03 am

Do Apache is in chroot? Did you tried to run that php script in chroot?

--
Daniel 'Shinden' Horecki
http://morr.pl

To: Gregory ESNAUD-FREE <gregory.esnaud@...>
Cc: <misc@...>
Date: Tuesday, April 24, 2007 - 5:31 am

You can use femail (in ports/packages) to fix this. It's easy to run
inside a chroot jail (use the STATIC flavour). It's a drop-in replacement
for /usr/sbin/sendmail, and submits the message to your real mailer (e.g.
on localhost) by SMTP.

To: Gregory ESNAUD-FREE <gregory.esnaud@...>, <misc@...>
Date: Tuesday, April 24, 2007 - 5:50 am

Hi all,

Thx for your all answer... someone talk to me about the Apache chroot,
so I unchroot it, and it's well functional.

But, If you follow me, I don't want that my apache be not chrooted (even
if i'm a big noob in security question, i'm not totally insane ^^). So,
Stuart, thanks for the femail pist, i will try it right now, but telle
me: is that a standalone emai server or it's living like an interface
between apache and the MTA?

thanks all,
Greg

To: <misc@...>
Date: Tuesday, April 24, 2007 - 5:54 am

You didn't check your logs, did you ? Just guessing.

--
Benoit Myard

To: Gregory ESNAUD-FREE <gregory.esnaud@...>
Cc: <misc@...>
Date: Tuesday, April 24, 2007 - 7:05 am

It's an interface, it takes the message and sends it to the MTA
by SMTP (by default, to port 25 on localhost; just copy it into the
chroot jail, and configure sendmail_path in php.ini).

(There are at least two other programs like this, femail is simpler
and less messy than the ones I know of).

To: <misc@...>
Date: Tuesday, April 24, 2007 - 5:17 am

It can't, the www server is chrooted under /var/www. If that is not the
problem, be sure to post back for more in-depth solutions.

Joachim

--
TFMotD: fpa, fea, fta (4) - DEC FDDI controller device driver

Previous thread: Out of Office AutoReply: hi by Warren, Luke on Tuesday, April 24, 2007 - 4:09 am. (1 message)

Next thread: root on raid with external usb disks by Eugene Hercun on Tuesday, April 24, 2007 - 7:33 am. (1 message)