Don Alexander Eckford's code for standard email:

Sending email failed.
 

CODE FOLLOWS

<?php

    
include('includes/header.php');

    
error_reporting(E_ALL);    // set error reporting to all

    
echo("<h1>Don Alexander Eckford's code for standard email:</h1>");

    
// use YOUR to/from email addresses

    
$mail_sent  '';
    
// use your student email address
    //$to = 'eckfordd@mail.lcc.edu';
    
$subject 'Subject';
    
$from_address 'eckfordd@mail.lcc.edu';
    
$from_name 'Don Alexander Eckford';

    
$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');
?>