//include the phpmailer class
require_once("class.phpmailer.php");
//-----------------------------------
//create variables using $_POST results
if ( $_POST['self_cert_checkbox'] == "0" )
{
$mailvar_selfCert = 'required';
}
else
{
$mailvar_selfCert = 'not required';
}
if ( $_POST['RTW_checkbox'] == "0" )
{
$mailvar_return2work = 'required';
}
else
{
$mailvar_return2work = 'not required';
}
$date = date("d/m/Y");
/*********** GENERATE THE EMAIL ***********/
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "cfrelay01"; // specify main server
$mail->SMTPAuth = false; // turn off SMTP authentication
//$mail->Username = "user"; // SMTP username
//$mail->Password = "pass"; // SMTP password
$mail->From = "no-reply@pipex.net";
$mail->FromName = "Managers Intranet - Disciplinary Logger";
//$mail->AddReplyTo("ADD REPLY TO", "NAME");
$mail->AddAddress("CCLtdBroadbandTM's@Christie.Local"); //exchange servers manager distribution list
$mail->WordWrap = 50; // set word wrap to 50 characters
//$mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = 'Disciplinary Event Logged for ' . $_POST['EM_name_hidfield'] . ' ';
$message = '---This message has been automatically generated by the Disciplinary logger---
';
$message .= 'The agent ' . $_POST['EM_name_hidfield'] . ' has had an action logged against them on ' . $date . '
';
$message .= 'The action was : ' . $_POST['Action_type_hidfield'] . '
';
$message .= 'The reason was : ' . $_POST['Action_for_select'] . '
';
$message .= 'It occured on : ' . $_POST['Action_start_field'] . '
';
$message .= 'It has an end date of : ' . $_POST['Action_end_field'] . '
';
$message .= 'Self Certification is ' . $mailvar_selfCert . '
';
$message .= 'A Return to work is ' . $mailvar_return2work . '
';
$message .= 'It was logged by : ' . $_SESSION['MD_Username'] . '
';
$message .= '**********************************************************
';
$message .= 'The following notes were added to the action:
' . $_POST['Acyion_notes_field'] . '
';
$message .= '**********************************************************
';
$message .= 'This is an automated message - please do not respond
';
//some user input will include \n, replace with
for HTML message
$message = nl2br($message);
//adds the body to the email and sends it
$mail->Body = $message;
//$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
//if the send fails output an error message
if (!$mail->Send())
echo 'There was an error please try again or contact gavin.taylor@pipex.net with details of what you were doing';
/****************************************/
?>