Skip to content

Instantly share code, notes, and snippets.

@sudhir600
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sudhir600/a2679be804c4468791e6 to your computer and use it in GitHub Desktop.
Save sudhir600/a2679be804c4468791e6 to your computer and use it in GitHub Desktop.
<?php
error_reporting(E_ALL);
$from = 'sudhirgupta.456@gmail.com';
$headers = "MIME-Version: 1.0" . PHP_EOL;
$headers .= "Content-Type: text/html; charset=UTF-8" . PHP_EOL;
$headers .= "From: " . $from . "\r\n";
$headers .= "Reply-To: " . $from . "\r\n";
$headers .= "Return-Path: " . $from . "\r\n";
$headers .= "CC: sudhirgupta500@yahoo.com \r\n";
$headers .= "BCC: others@yahoo.com\r\n";
// EOL is new line for cross-browser support
$subj = 'a test mail via php script';
$body = 'Hy all! pls check your mail box,
<a href="http://quicklesson.info">visit here</a>
<br />Thanks';
$to = (!isset($_REQUEST['to']) ? 'sudhirgupta@yahoo.com' : $_REQUEST['to']);
$done = mail($to, $subj, $body, $headers);
if ($done) {
$result = 'mail send to ' . $to . ' from ' . $from;
}
else {
$result = 'mail not send' . error_get_last();
}
echo '<div style="height:auto;min-height:150px;width:300px;background-color:rgb(60, 21, 60);margin:0 auto;font-family:arial;padding:20px;color:#fff;font-size:19px;text-transform:capitalize">
' . $result . '
</div>';
?>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment