Jason Costomiris on Tue, 2 May 2000 10:55:01 -0400 (EDT)


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

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


On Mon, May 01, 2000 at 07:22:35PM -0400, Brent R. Matzelle wrote:
: I'm trying to figure out how to use that tricky little /usr/sbin/sendmail
: program to send a message with PHP.

You want the mail() function.

This example assumes:

1) you set the $to var to the address you want the mail to go to.
2) you get the person's name as $name
3) you get the person's email as $email
4) you get the email subject as $subject
5) you get the message body as $body

<?
	$to = "you@somewhere.com";
	$extra_headers = sprintf("From: %s <%s>\nX-IP: %s", 
								$name, $email, $REMOTE_ADDR);
    mail($to, stripslashes($subject), stripslashes($body), $extra_headers);
?>

-- 
Jason Costomiris <><           |  Technologist, geek, human.
jcostom {at} jasons {dot} org  |  http://www.jasons.org/ 

______________________________________________________________________
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