It would seem much safer to establish a TCP connection to the local MTA over port 25 or 587 and send the message that way.
Admins can just use iptables to restrict access to the port to localhost, and/or do the same in their MTA config.
It would seem much safer to establish a TCP connection to the local MTA over port 25 or 587 and send the message that way.
Admins can just use iptables to restrict access to the port to localhost, and/or do the same in their MTA config.
The best way I've found to send mail on behalf of someone else is to leave the return path (-f) and From header pointing to your own domain, and use the Reply-To header with the users email.
"To deliver electronic mail (email), applications shall support the interface provided by sendmail (described here). This interface shall be the default delivery method for applications."
http://refspecs.linux-foundation.org/LSB_3.0.0/LSB-PDA/LSB-P...
Last time I tried configuring a Linux-hosted PHP to do SMTP on localhost:25 instead of shelling out to call sendmail, I found that only Windows builds even have that functionality compiled in. You can apply the same configuration options on a stock Linux build, and they won't cause errors, but they won't do anything, either. Maybe that's changed recently, but it would have to have been very recently, because I ran into this (for the umpteenth time) just a few months ago, while reworking my team's dev environment to allow for examining sent mail without requiring heroism.
I'm not a PHP hater, exactly. I don't like the language at all, but I understand it well and have made a very good living based partly on that knowledge. But the mail story in PHP has never not been a dumpster fire.