[Nottingham] PHP and Sendmail / Exim / QMail

Graeme Fowler graeme at graemef.net
Fri Nov 17 09:31:23 GMT 2006


Hi

On 16/11/2006 17:34, Ricky Hayes wrote:
> We have a PHP script running on a Linux box that uses the PHP mail() 
> command to send mail via the above mentioned MTAs.
> 
> There’s a varying time delay from when we execute the mail() command, to 
> when we get some kind of response ( a true/false ).
> 
> Is there any way we can not wait for this response, and simply get a 
> true/false immediately, and hope that the mail has been queued as normal?

PHP's mail() function uses a system call as defined in php.ini. The 
default is:

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
;
; For Win32 only.
;sendmail_from = me at example.com
;
; For Unix only.  You may supply arguments as well (default: "sendmail 
-t -i").
sendmail_path = /usr/sbin/sendmail -t -i
;
; 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 =

So in theory you should be calling a binary app on the command line and 
pushing your mail into it (the -t switch defines "here comes an RFC2822 
formatted message, either via pipe or redirect")

Unless you're doing spam scanning on locally generated messages, it 
should return success or failure almost immediately.

What's your PHP mail function set to do?

Graeme



More information about the Nottingham mailing list