php and postfix

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
jabrilm
Forum Newbie
Posts: 1
Joined: Thu Oct 22, 2009 12:39 pm

php and postfix

Post 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.
wajordan
Forum Newbie
Posts: 3
Joined: Fri Oct 30, 2009 8:58 pm

Re: php and postfix

Post 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
Post Reply