Saturday, April 17, 2010

Code for sending email using php?

Could someone write the html/php code for me? I want someone to enter their name, email address, subject, and body of the message. On send, I want the email sent to me@mine.com, I'll change it later, with their name attached to the email, and an email sent to their email address from do-not-reply@mine.com with the same subject and my reply message.





I know I'm asking for a lot but I'm thinking that someone may already have it written for the same reason.

Code for sending email using php?
Just make a regular form and post to your PHP script.


In the PHP script parse the form vars like so..





// parse variables from form; make sure POST


// names match the names on the form


$NAME = $_POST['NAME'];


$from_mail = $_POST['EMAIL'];


$subject = $_POST['SUBJECT'];


$message = $_POST['MSG'];








// build the headers. I'm using html so html


// messages can be sent


$headers = "Content-type: text/html\r\n";


$headers = $headers."From: $from_mail\r\n";


$pEMAIL = "me@mine.com";





// here is the code to send the message.


mail($pEMAIL, $subject, $message, $headers);
Reply:Check the mail function at php.net. It's all you need.





Good luck!

dental hygienist

No comments:

Post a Comment