Re: PHP mail
| From: | Mathieu Dumoulin | Date: | Thu, 05 May 2005 14:52:17 +0000 |
| Subject: | Re: PHP mail | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-214540@lists.php.net to get a copy of this message | ||
Eustace wrote:
I am relatively new to PHP and could use some help. I have a form, which is basically in an email format, from, subject, and message. How do I then send this to an email? I know a bit about the mail function, somebody show me the ropes please! EustaceI'll show you how we do it here at work, its quite simple: //Target message setup $target_receptemail = 'insert email here'; $target_receptname = 'insert the targets name here'; $target_senderemail = 'insert your email here'; $target_sendername = 'insert your name here'; //Message body setup //Target setup $target_bodymsg = 'Insert content here'; $target_subjectmsg = 'Insert subject here'; //Build the headers $headers = array( 'From: '.$target_sendername.' <'.$target_senderemail.'>', 'Content-Type: text/html' ); //Send the mail mail( $target_receptemail, $target_subjectmsg, $target_bodymsg, implode("\r\n", $headers) );