Example #1
0
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;
}
Example #2
0
// default in /config.php
$site['from_name'] = 'Safari On The River';
// default in /config.php
// Delivery addresses must be arrays...
$site['to_email'] = array($_POST['customer_email']);
$site['BCC_email'] = array();
$site['CC_email'] = array();
$site['replyToEmail'] = $site['from_email'];
$site['replyToName'] = $site['from_name'];
$site['subject'] = "Safari on the River Ticket Confirmation";
$site['body'] = $request;
// handle mail sending
// Grab the FreakMailer class (already imported)
//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');
Example #3
0
<?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();
Example #4
0
 } else {
     $request = "SPAM!!!\n\nLooks like SPAM: " . date("l F j, Y") . "\n\n";
 }
 $request .= "Name: " . $_POST['Name'] . "\n\n";
 $request .= "Phone: " . $_POST['Phone'] . "\n\n";
 $request .= "Email: " . $_POST['email'] . "\n\n";
 $request .= "Question: " . $_POST['Question'] . "\n";
 $request = stripslashes($request);
 $isNotEmpty = $_POST['Name'] . $_POST['Phone'] . $_POST['email'] . $_POST['Question'] != "";
 if ($_POST['Additional_Info'] == '' && $CommentHasHttp_b == false && $isNotEmpty) {
     // the secret question is not shown to real users so must be empty
     // No longer actually send the spammers mail
     // $site array now exists
     $fromAddress = $site['from_email'];
     // instantiate the class
     $mailer = new FreakMailer();
     $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;
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;
}