SMTPAuth = true; // enable SMTP authentication $mailObject->Port = 25; // set the SMTP server port $mailObject->Host = "localhost"; // SMTP server $mailObject->Username = "schoolappointments"; // SMTP server username $mailObject->Password = "Online3214++.."; // SMTP server password $mailObject->CharSet = "UTF-8"; $mailObject->IsSendmail(); // tell the class to use Sendmail $mailObject->ClearAddresses(); $mailObject->ClearAllRecipients(); $mailObject->ClearAttachments(); if (strlen($emailSender) == 0) $emailSender = "mail@hotlunches.net"; $emailSender = $emailTo; $emailSenderName = $emailReply; // $emailSender = "mail@hotlunches.net"; // $emailSenderName = "Hot Lunches Online"; $mailObject->AddReplyTo($emailFrom, $emailReply); $mailObject->SetFrom($emailSender, $emailSenderName, 1); $mailObject->Sender = $emailSender; $mailObject->From = $emailSender; $mailObject->From = $emailTo; $mailObject->AddAddress($emailTo, $emailRecipient); $mailObject->Subject = $emailSubject; $mailObject->IsMail(); // tell the class to use Mail $mailObject->IsSMTP(); // tell the class to use SMTP $mailObject->IsSendmail(); // tell the class to use SendMail // Process a template if one is passed if (isset($templateFile) && strlen($templateFile) && is_file($templateFile)) { $template = file_get_contents($templateFile); } $emailMessage = htmlspecialchars_decode($emailMessage,ENT_QUOTES); $emailMessage = preg_replace("#&#","&",$emailMessage); // Use template if available if (isset($template) && strlen($template)) { $Message = ereg_replace("\{EMAIL_BODY_TEXT\}",$emailMessage,$template); $mailObject->MsgHTML($Message); } else { if (strip_tags($emailMessage) == $emailMessage) { // Send as a plain text message $mailObject->Body = $emailMessage; } else { // Send HTML message $mailObject->MsgHTML($emailMessage); } } // Attach any attachments if (is_array($attachments) && count($attachments) > 0) { for ($i = 0; $i < count($attachments); $i++) { $file = $attachments[$i]; if (is_file($file)) { $mailObject->AddAttachment($file); } } } // Send message $mailObject->Send(); return(1); } } ?>