Re: using mail()

From: Date: Fri, 01 Aug 2003 17:17:35 +0000
Subject: Re: using mail()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-157986@lists.php.net to get a copy of this message
"Amanda McComb" <amccomb@indiana.edu> wrote in message news:Pine.GSO.3.96.1030801115707.20844C-100000@kate.ucs.indiana.edu... > If I am using this code: > > mail("amccomb@indiana.edu", "test", "testbody"); > > and want to add a From: line, how do I do it? > > Also, is this an excepted way of sending mail from a web page? > > Thanks, > Amanda The mail() function has two optional inputs. Additional Headers and Additional Parameters. FROM and other optional headers can be set up like this.. $headers = "From: me@here.com\r\n"; $headers .= "Cc: you@there.com\r\n"; $headers .= "Reply-To: him@anywhere.com\r\n"; And then included as the fourth input to the function.. mail("amccomb@indiana.edu", "test", "testbody", $headers); Be aware that forging headers can get you into trouble with the spam blockers regardless of the legitimacy of your intentions. Go to Google Groups and read up on what you need to know in order to keep your legitimate mail servers from being black listed. Read more about the mail() function.. http://www.php.net/manual/en/function.mail.php -Kevin

« previous php.general (#157986) next »