Send an email. (simple)


/ Published in: PHP
Save to your folder(s)

A simple example of how to send an email using PHP's build in mail() function.


Copy this code and paste it in your HTML
  1. <?php
  2. function sendMail($from,$to,$subject,$body)
  3. {
  4. $headers = "From: $from";
  5. $headers .= "Reply-To: $from";
  6. headers .= "Return-Path: $from";
  7. $headers .= "X-Mailer: PHP5\n";
  8. $headers .= 'MIME-Version: 1.0' . "\n";
  9. $headers .= 'Content-type: text/html; charset=utf-8' . "";
  10. @mail($to,$subject,$body,$headers);
  11. }
  12. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.