Click to See Complete Forum and Search --> : PHP & Sendmail


King Zarathu
December 19th, 2007, 04:48 PM
Well, after trying tons of other forums, I come here hoping someone knows what's going on.

I'm using an Ubuntu x86 machine, with PHP and Sendmail installed.

sudo apt-get install sendmail

SSMTP is also installed.

zarathu@jesus:~$ sendmail
sendmail: No recipients supplied - mail will not be sent
zarathu@jesus:~$

K, point is, it's working.

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

; For Win32 only.
;sendmail_from = me@example.com

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

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =



That's in my php.ini file.

The email won't send! mail() returns a value of 1, yet the email doesn't get sent at all. Doesn't even hit the bulk folder. :/




lolwat?!?!1

PeejAvery
December 19th, 2007, 06:20 PM
The function mail() will return true because the function did fire. However, even though it returns true, that never means that e-mail was sent. This is a configuration problem.

Have you tried passing parameters to the php.ini sendmail_path to see if it will pass any e-mail?

King Zarathu
December 19th, 2007, 06:43 PM
Have you tried passing parameters to the php.ini [i]sendmail_path[i] to see if it will pass any e-mail?
I'm afraid I don't understand what you're suggesting.

PeejAvery
December 19th, 2007, 06:48 PM
In the php.ini configuration, you can add parameters. Are there any parameters needed for your configuration? If so, you need to add those to the php.ini configuration.

King Zarathu
December 19th, 2007, 06:56 PM
Right. No, passing parameters does not work.

http://www.thesarcasm.com/paste.php?id=6452795

I pasted my sendmail.conf file in case you were going to want to look over it. I'm also having this same problem on my OpenBSD 4.2 server, with Apache and PHP installed.

PeejAvery
December 19th, 2007, 11:25 PM
No. That seems fine. Have you tried/tested any other applications that can use sendmail and see if those work?

King Zarathu
December 20th, 2007, 01:41 AM
No. That seems fine. Have you tried/tested any other applications that can use sendmail and see if those work?
Nope! I don't know of any applications that would. :/

Is Sendmail supposed to be listening on port 25 for this to work? Or does that not matter?

It's listening, by the way. I can telnet into localhost:25 and it returns the header and waits for input.

PeejAvery
December 20th, 2007, 08:14 AM
Your SMTP server is listening on port 25, not sendmail. Since you have an SMTP server, you don't need to have sendmail_path configured in your php.ini file.

Comment out the sendmail_path and add the following.

SMTP = localhost
smtp_port = 25

King Zarathu
December 20th, 2007, 11:55 AM
Your SMTP server is listening on port 25, not sendmail. Since you have an SMTP server, you don't need to have sendmail_path configured in your php.ini file.

Comment out the sendmail_path and add the following.

SMTP = localhost
smtp_port = 25
Isn't that Windows only?

PeejAvery
December 20th, 2007, 12:40 PM
No. It is titled Win32 but that is not fully applicable. It applies for all SMTP servers. At my office we run SUSE Linux but use that for our PHP configuration. And we send hundreds of mails a day.

King Zarathu
February 2nd, 2008, 03:19 PM
-bash-3.2$ telnet
telnet> o
(to) localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 hostname ESMTP Sendmail 8.14.1/8.14.0; Sat, 2 Feb 2008 14:19:14 -0600 (CST)


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

SMTP = localhost
smtp_port = 25

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =


However, when I execute any function with mail(), it hangs for a very long amount of time before returning 1. The email is never actually sent.

I'm using an OpenBSD 4.2 server.

PeejAvery
February 5th, 2008, 03:21 PM
You titled this PHP & Sendmail. What part does PHP play into this? It looks like a simple Linux bash script.

King Zarathu
February 8th, 2008, 06:18 PM
Because whenever PHP executes its mail() function, the email is never sent.

PeejAvery
February 11th, 2008, 07:40 AM
[ merged ]

PeejAvery
February 11th, 2008, 07:40 AM
It sounds to me that the problem is the installation of Sendmail itself.