Joe Laudadio on Mon, 1 May 2000 20:31:22 -0400 (EDT)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] /usr/bin/sendmail program w/PHP



It's probably not advisable to invoke sendmail with an exec() call,
something about it just rings the this-probably-isnt-very-secure bell with
me.  Fortunately, php has a builtin function to send mail: mail(). The
prototype is

bool mail(string to, string subject, string message, string [additional_headers]);

the additional_headers is not necessary. It defaults to invoking the mail
agent with "sendmail -t". If that's not sufficient for you (maybe you run
qmail not sendmail) then you can change the "sendmail_path" variable in
php3.ini (mine was in /usr/local/lib). Hope this helps.

mg

 On Mon, 1 May 2000, Brent R. Matzelle wrote:

> Hello,
> 
> I'm trying to figure out how to use that tricky little /usr/sbin/sendmail
> program to send a message with PHP.
> 
> I've tried the command:
> 
> exec("/usr/sbin/sendmail < $message_with_headers");
> 
> and many others but to no effect.  I've tried a bunch of different formats for
> the mail file too.  
> 
> e.g.
> MAIL FROM: user@email.com
> RCPT TO: otheruser@otheremail.com
> DATA
> Subject: Subject header
> Message
> ..
> You get the idea... 
> 
> The man page is quite confusing.  Is anyone familiar with the syntax and
> could give me an example or two of how to make it work?  
> 
> Brent
> 
> -- 
> http://www.matzelle.net
> 
> ______________________________________________________________________
> Philadelphia Linux Users Group       -       http://plug.nothinbut.net
> Announcements - http://lists.nothinbut.net/mail/listinfo/plug-announce
> General Discussion   -   http://lists.nothinbut.net/mail/listinfo/plug
> 


______________________________________________________________________
Philadelphia Linux Users Group       -       http://plug.nothinbut.net
Announcements - http://lists.nothinbut.net/mail/listinfo/plug-announce
General Discussion   -   http://lists.nothinbut.net/mail/listinfo/plug