Veronica's code for standard email:
Successfully sent an email to: hutchinv@mail.lcc.edu
 
<?php
include('includes/header.php');
// set error reporting to all
error_reporting(E_ALL);
echo("<h1>Veronica's code for standard email:</h1>");
// using my to / from email addresses
$mail_sent = '';
// using my student email address
$to = 'hutchinv@mail.lcc.edu';
$subject = 'Subject';
$from_address = 'hutchinv@mail.lcc.edu';
$from_name = 'Veronica Hutchins';
$body = "This is from a more complicated mail script! Mailing myself through a 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);
// uncommented 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');
?>