function sendHtmlMail($toAddress, $subject, $htmlContent, $plainContent) { // Grab our config settings require_once $_SERVER["DOCUMENT_ROOT"] . '/phpmailer-2.0.2/config.php'; require_once $_SERVER["DOCUMENT_ROOT"] . '/phpmailer-2.0.2/FreakMailer.inc'; $result = ""; // Grab the FreakMailer class // instantiate the class $mailer = new FreakMailer(); $mailer->IsHTML(true); $mailer->CharSet = "ISO-8859-1"; $mailer->ClearAttachments(); $mailer->From = 'ike@yoursite'; $mailer->FromName = 'yoursite staff'; // bounces!! $mailer->Sender = 'ike@yoursite'; // Set the subject $mailer->Subject = $subject; // Body $mailer->Body = $htmlContent; $mailer->AltBody = $plainContent; // Add an address to send to. $mailer->AddAddress($toAddress); $mailer->Send(); $result = $mailer->ErrorInfo; $mailer->ClearAddresses(); $mailer->ClearAttachments(); return $result; }
//require_once($site['config_library'].'/MailClass.inc'); // instantiate the class $mailer = new FreakMailer(); // Set the subject $mailer->Subject = $site['subject']; // Body $mailer->Body = $site['body']; // Setup the from and Reply to $mailer->From = $site['from_email']; $mailer->FromName = $site['from_name']; if ($site['replyToEmail'] != '') { $mailer->AddReplyTo($site['replyToEmail'], $site['replyToName']); } // Add To addresses for ($i = 1; $i <= count($site['to_email']); $i++) { $mailer->AddAddress($site['to_email'][$i - 1]); } //$mailer->AddAddress('*****@*****.**', 'Bill Leddy'); // add CC addresses for ($i = 1; $i <= count($site['CC_email']); $i++) { $mailer->AddCC($site['CC_email'][$i - 1]); } // add BCC addresses for ($i = 1; $i <= count($site['BCC_email']); $i++) { $mailer->AddBCC($site['BCC_email'][$i - 1]); } //$mailer->AddBCC('*****@*****.**', 'Bill Leddy'); if (trim($_POST['customer_email']) != '') { //Actually send the email if (!$mailer->Send()) { echo "Fail";
<?php // Grab our config settings require_once './config.php'; // Grab the FreakMailer class require_once './FreakMailer.inc'; // instantiate the class $mailer = new FreakMailer(); // Set the subject $mailer->Subject = 'This is a test'; // Body $mailer->Body = 'This is a test of my mail system!'; // Add an address to send to. $mailer->AddAddress('*****@*****.**', 'Eric Rosebrock'); if (!$mailer->Send()) { echo 'There was a problem sending this mail!'; } else { echo 'Mail sent!'; } $mailer->ClearAddresses(); $mailer->ClearAttachments();
$DEBUG = false; $mailer->SMTPDebug = $DEBUG; // Set the subject $mailer->Subject = "Web Contact"; // Body $mailer->Body = $request; // Setup the from and Reply to $mailer->From = $fromAddress; //$mailer->FromName = $_POST['Name']; $mailer->AddReplyTo($_POST['email'], $_POST['Name']); // test that it took a little while for the customer to complete the form // If not, we assume it's spam $interval = time() - intval($_POST['Code']); if ($interval < 5) { $mailer->Subject = "Web Contact for " . gethostname() . " - Too fast: " . $interval; $mailer->AddAddress('*****@*****.**', 'Bill Leddy'); } elseif ($CommentHasHttp_b === false) { // default to address is same as sender from config.php $mailer->AddAddress($site['from_email'], ''); $mailer->AddBCC('*****@*****.**', 'Bill Leddy'); } else { // this looks like spam $mailer->AddAddress('*****@*****.**', 'Bill Leddy'); } if (!$mailer->Send()) { ?> <h3>Sorry, there is a problem with our email system.</h3> <pre><?php echo $mailer->ErrorInfo . " "; ?> </pre>
function functSendEmail($emailaddr, $strSubject, $strBody, $name, $strFromName, $strFromEmail, $strAttachmentFileFullPath, $strEmailType = "text/plain") { //base function to send all emails from webservers smtp service if ($strFromName == "") { $strFromName = EMAIL_FROM_NAME; } if ($strFromEmail == "") { $strFromEmail = EMAIL_FROM_ADDR; } // instantiate the class $mailer = new FreakMailer(); // Get From Variable from Constants File $mailer->ContentType = $strEmailType; if ($strEmailType == "text/html") { $strHTMLMime = true; } else { $strHTMLMime = false; } $mailer->IsHTML($strHTMLMime); $mailer->From = $strFromEmail; $mailer->FromName = $strFromName; $mailer->Subject = $strSubject; $mailer->Body = $strBody; if (is_array($emailaddr)) { foreach ($emailaddr as $email) { $mailer->AddAddress($email, $name); } } else { //send one $mailer->AddAddress($emailaddr, $name); } //now Attach file submitted if ($strAttachmentFileFullPath && file_exists($strAttachmentFileFullPath)) { $mailer->AddAttachment($strAttachmentFileFullPath); } if (!$mailer->Send()) { $strErrorString = 'There was a problem sending this mail!'; } else { $strErrorString = "sent"; } $mailer->ClearAddresses(); $mailer->ClearAttachments(); return $strErrorString; }