Skip to content

Instantly share code, notes, and snippets.

@amberlex78
Created October 3, 2015 07:12
Show Gist options
  • Select an option

  • Save amberlex78/c96973ee167773007118 to your computer and use it in GitHub Desktop.

Select an option

Save amberlex78/c96973ee167773007118 to your computer and use it in GitHub Desktop.
Clean PHP code for mail
<?php
$headers = array();
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-type: text/html; charset=utf-8";
$headers[] = "From: Sender Name <sender@domain.com>";
$headers[] = "Bcc: JJ Chong <bcc@domain2.com>";
$headers[] = "Reply-To: Recipient Name <receiver@domain3.com>";
$headers[] = "Subject: {$subject}";
$headers[] = "X-Mailer: PHP/".phpversion();
mail($to, $subject, $email, implode("\r\n", $headers));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment