Page 1 of 1

php and postfix

Posted: Thu Oct 22, 2009 12:41 pm
by jabrilm
Hello, I am using PHP and trying to send an email from within the PHP script using the mail() function. This is PHP 5.2.4 and Ubuntu Hardy Heron. I am just trying to send the email to myself to check whether this works. The PHP script does not generate any error and the return value for the mail() function is TRUE, but the email does not arrive.

I had sendmail installed originally but read that people have had better luck with postfix, so I installed that. Postfix seems to be working from what I can tell. I can do

telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 homemade ESMTP Postfix (Ubuntu)
ehlo localhost
250-homemade
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

But the email is still not received from the PHP script. The problem may be in the php.ini file. These are the relevant settings:

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = anyone@anyone.com

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = /usr/sbin/sendmail -t -i

Thanks for any help you can give.

Re: php and postfix

Posted: Fri Oct 30, 2009 10:42 pm
by wajordan
I recently had to setup a ubuntu server with postfix and it took me 4ever :)
I was using 9.04 Jaunty Jack I think...

First you need to comment these two lines out like so (settings only for Windows):
;SMTP = localhost
;smtp_port = 25

Tons of good info HERE