<?php
include('includes/header.php');
error_reporting(E_ALL); // set error reporting to all
echo("<h1>Brian Lark's code for standard email:</h1>");
// use YOUR to/from email addresses
$mail_sent = '';
// use your student email address
//$to = 'larkb@mail.lcc.edu';
$subject = 'Subject';
$from_address = 'larkb@mail.lcc.edu';
$from_name = 'Brian Lark';
$body = "This is from a more complicated mail script!\n";
$subject = "More complicated mail (CITW)";
$eol="\r\n";
// Common Headers
$headers = "From: ".$from_name."<".$from_address.">" . $eol;
$headers .= "Reply-To: ".$from_name."<".$from_address.">" . $eol;
$headers .= "Return-Path: ".$from_name."<".$from_address.">" . $eol;
$headers .= "Message-ID: <".time()."-".$from_address.">" . $eol;
$headers .= "X-Mailer: PHP v".phpversion() . $eol;
// HTML Version
$headers .= "Content-Type: text/html; charset=utf-8" . $eol;
$headers .= "Content-Transfer-Encoding: 8bit". $eol . $eol;
$message = $body . $eol . $eol;
ini_set('sendmail_from', $from_address);
// uncomment the below statement for this to work
$mail_sent = mail($to, $subject, $message, $headers);
ini_restore('sendmail_from');
if($mail_sent)
{
echo("Successfully sent an email to: $to");
}
else
{
echo('Sending email failed.');
}
include('includes/footer.php');
?>