11/25/2008

Tutorial: Adding CC ME to your PHP email form.

This is a very simple and easy way to make a CC ME in your HTML form. A CC ME is a great tool to have on your website. When the person is filling out the form on your website, give them the ability to copy themselves on the email as well. This way they have your email within their inbox so all they have to do is click on reply instead of coming back to your website.

Take a look at the the Creating a form in PHP and XHTML post I did earlier. Add the following code at the very bottom right above the ?>.


//ccme
if(@$_POST['ccme']){ //the name of the cc me checkbox (cc me)

$user = “”;
$user .= “Thank you for contacting me. I usually reply within 24 hours. “;
$user .= “\n”;
$user .= “You are receiving this email because you clicked on ‘cc me’ within the form you submitted on myself, www.mattginsberg.net.”;
$user .= “\n “;
$user .= “Here are your comments:;
$user .= “\n”;
$user .= $comments;
$user .= “\n”;
$user .= “\n “;
$user .= “Thank you “;
$user .= “Matt”;
$EmailTo = ‘matt@mattginsberg.net ‘; //from me
$from=$_POST['from']; //the name of the email input field on your form
$subject=’Thank you for submitting the form at mattginsberg.net ‘.$_POST['subject'];
mail($from,$subject,$user, “from:<$EmailTo>”);

To make this CC ME come to life, add a checkbox in your website’s form and name it ccme.

Feel free to break this down and ask me any questions if you have any.

Don’t forget to leave comment’s!!!


HELP SPREAD THE WORD!



Posted in PHP Tutorials

No Comments »

Random Posts

Filed under PHP Tutorials