Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
01-01-2013, 09:04 AM
|
#1
|
Member
Registered: Sep 2012
Posts: 86
Rep: 
|
making php use "mail" instead of sendmail
Im using debian stable.
how do I get php to use "/usr/bin/mail" instead of "sendmail" to send local mail (that is, on the same machine, to a user)?
I've set sendmail_path = /usr/bin/mail
but no success.
here's the revelant part of my php.ini file:
TIA
Code:
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = me@example.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = /usr/bin/mail
; 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 =
; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = On
; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log =
Last edited by mzzxx11; 01-01-2013 at 09:05 AM.
|
|
|
01-02-2013, 04:55 AM
|
#2
|
Member
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
|
|
|
|
01-02-2013, 05:00 AM
|
#3
|
Member
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
|
Your file says
Quote:
(default: "sendmail -t -i")
|
which is ok for sendmail (is it -i these days and not -oi ?) but wrong for /usr/bin/mail .
|
|
|
01-02-2013, 08:48 AM
|
#4
|
Senior Member
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,908
|
The problem is that mail is a mail user agent (MUA), and sendmail a mail transfer agent(MTA).
PHP is using sendmail to transfer mail from it to another (possibly remote) server. So in this structure, PHP is acting as the user agent.
One difference between MUA and MTA is that in sending mail from a user agent the destination address is expected on the command line. In the MTA it is expected as part of the input stream. That is what the -t option on the default is for, it scans the input message for To:, Cc:, and Bcc for destination addresses. The MUA expects that to be on the command line.
One advantage the sendmail used in this manner is that it is the one that determines whether a remote destination or a local one is needed. If local delivery is called for, then it goes directly to the local mail files without involving any other process.
Now that said, if you have a local mail deliver (sendmail or other) you CAN get the equivalent. What you use is "telnet localhost 25" (assuming your local mail server is using port 25 by default. This may accept the message (unless it requires a password or some extra handshaking) and blindly accept the data.
It isn't correct, as this ignores the handshaking that may be required (things like "address invalid" or "user invalid" or "reject" responses). This additional handshaking is another reason PHP uses sendmail - the appropriate handshaking is already done.
You CAN replace sendmail with something like qmail or postfix (not an endorsement - I happen to like sendmail due to its flexibility. but others do).
Last edited by jpollard; 01-02-2013 at 08:58 AM.
Reason: A little additional info
|
|
|
All times are GMT -5. The time now is 07:55 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|