Was it really not sufficient to simply set the From: header appropriately and make sure that your Apache user id was configured as a trusted sendmail user?
On Wed, 20 Mar 2002, Eric Dynamic wrote: > I've written another mail function to deal with one of our ISP clients' needs. > I don't know if the functionality is found elsewhere - nowhere in the documentation > that I have seen, though. > > The standard mail function is > > mail( to, subject, message, optional-headers ) > > The client had two issues. First is not a big deal, they had a file to send but >mail() > wants a string for the body. A file can be read into a string, so that's not major, >but > still it'd be nice to be able to read the content from a file, especially when the >content > is large. > Second issue was more critical. We need for the user to coerce their identity for > sendmail using "-f", but there's no way to pass additional parameters to the mailer > with mail(). The php.ini is sitewide and the users need to submit different values >for "-f". > > I've written and done preliminary testing for a function > > mailfx( to, subject, filename, optional-headers, optional-parameters ) > > where "mailfx" means "mail from file, extended". > > The optional parameters are appended to the mailer path before the mailer is invoked, > so that allows "-f username" for sendmail. The length of the mailer path plus the > parameters is verified not to exceed the length of the buffer used to do this. > The optional headers are used as with mail(). > The filename replaces the string. Now, the file is checked and opened (code ripped >off > from ext/standard/file.c), and the contents are read in and written to the mailer. > > The version I have works on Unix. I've left the relevant ifdef WIN32's in place for a > Windows person to complete the Windows version (since I won't assume parameters are > handled the same on Windows.) Hopefully not much work there. > > Having the parameter version read a file and the normal version use a string is a >little > awkward, maybe a better thing to do is make an extended function that provides a flag > to indicate if the source is a file or a string. Yet another argument... Anyway, this > thing works for me as an integral part of PHP4 - I used the code of php-4.0.3pl1 to >do this. > > Something like this would be generally useful. If PHP core team is interested, let >me know > what I need to submit for review for possible inclusion. > > -ecsd > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php