Skip to content

Instantly share code, notes, and snippets.

@tahirm
Last active December 17, 2015 13:49
Show Gist options
  • Save tahirm/5619467 to your computer and use it in GitHub Desktop.
Save tahirm/5619467 to your computer and use it in GitHub Desktop.
PHP: Email
$aResponse = array('success' => false);
$from = $_POST['email'];
$message = $_POST['msg'];
$subject = $_POST['name'];
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: ' . $from . "\r\n";
$headers .= 'Bcc: test@email.com' . "\r\n";
$headers .= 'Bcc: test@email.com' . "\r\n";
$reciever = "test@email.com";
if(mail($reciever, $subject, $message, $headers)){
$aResponse['success'] = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment