We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

gfazioli on 10/08/08


Tagged

php mail strip tags


Versions (?)


Who likes this?

3 people have marked this snippet as a favorite

tikitakfire
luman
gfazioli


Formatting PHP mail params


Published in: PHP 


URL: http://www.undolog.com

The right way to send a mail with POST params

  1. if( isset( $_POST['name'] ) &&
  2. isset( $_POST['email'] ) &&
  3. isset( $_POST['subject'] ) &&
  4. isset( $_POST['message'] ) ) {
  5.  
  6. $to = 'Jon <g.fazioli@undolog.com>';
  7.  
  8. mail($to, strip_tags( $_POST['subject'] ), stripslashes( utf8_decode( strip_tags( $_POST['message'] ) ) ), 'From: '.strip_tags( $_POST['name'] ).'<'.$_POST['email'].'>' );
  9. }

Report this snippet 

You need to login to post a comment.