コード例 #1
0
ファイル: email.class.php プロジェクト: verbazend/AWFA
 function sendemail($remail, $cc, $bcc, $subject, $message, $attachments, $listingID = 0)
 {
     $semail = db::getGlobalSetting('defaultemailsender');
     $sname = db::getGlobalSetting('defaultemailsendername');
     //$bcc = "*****@*****.**";
     //$remail = $bcc;
     $rname = "";
     $priority = "high";
     $type = "";
     $replysemail = db::getGlobalSetting('defaultemailsenderreplytoemail');
     // Checks if carbon copy & blind carbon copy exist
     if ($cc != null) {
         $cc = "CC: " . $cc . "\r\n";
     } else {
         $cc = "";
     }
     if ($bcc != null) {
         $bcc = "BCC: " . $bcc . "\r\n";
     } else {
         $bcc = "";
     }
     // Checks the importance of the email
     if ($priority == "high") {
         $priority = "X-Priority: 1\r\nX-MSMail-Priority: High\r\nImportance: High\r\n";
     } elseif ($priority == "low") {
         $priority = "X-Priority: 3\r\nX-MSMail-Priority: Low\r\nImportance: Low\r\n";
     } else {
         $priority = "";
     }
     // Checks if it is plain text or HTML
     if ($type == "plain") {
         $type = "text/plain";
     } else {
         $type = "text/html";
     }
     // The boundary is set up to separate the segments of the MIME email
     $boundary = md5(@date("Y-m-d-g:ia"));
     // The header includes most of the message details, such as from, cc, bcc, priority etc.
     $header = "From: " . $sname . " <" . $semail . ">\r\nMIME-Version: 1.0\r\nX-Mailer: PHP\r\nReply-To: " . $sname . " <" . $replysemail . ">\r\nReturn-Path: " . $sname . " <" . $replysemail . ">\r\n" . $cc . $bcc . $priority . "Content-Type: multipart/mixed; boundary = " . $boundary . "\r\n\r\n";
     // The full message takes the message and turns it into base 64, this basically makes it readable at the recipients end
     $fullmessage .= "--" . $boundary . "\r\nContent-Type: " . $type . "; charset=UTF-8\r\nContent-Transfer-Encoding: base64\r\n\r\n" . chunk_split(base64_encode($message));
     // A loop is set up for the attachments to be included.
     if ($attachments != null) {
         foreach ($attachments as $attachment) {
             $attachment = explode(":", $attachment);
             $fullmessage .= "--" . $boundary . "\r\nContent-Type: " . $attachment[1] . "; name=\"" . $attachment[2] . "\"\r\nContent-Transfer-Encoding: base64\r\nContent-Disposition: attachment\r\n\r\n" . chunk_split(base64_encode(file_get_contents($attachment[0])));
         }
     }
     // And finally the end boundary to set the end of the message
     $fullmessage .= "--" . $boundary . "--";
     self::logemail($remail, $cc, $bcc, $subject, $message, $listingID, $_SESSION['userid']);
     esmtp::sendemail_smtp($remail, $subject, $message);
     //echo($fullmessage);
     return true;
     //mail($rname."<".$remail.">", $subject, $fullmessage, $header);
 }
コード例 #2
0
ファイル: email.class.php プロジェクト: verbazend/AWFA
 function sendBookingConfirmation($bookingID, $instanceID, $enrolVar, $ccEmail = false)
 {
     $enrolVar['state'] = getStateFromPostcode($enrolVar['postcode']);
     //$instanceID = "161835";
     $courseDetailObj = getEventDetails($instanceID);
     $courseDetails['name'] = $courseDetailObj['websiteName'];
     $courseDetails['date'] = date("l", strtotime($courseDetailObj['courseDate'])) . "<br>" . date("j", strtotime($courseDetailObj['courseDate'])) . "<sup>" . date("S", strtotime($courseDetailObj['courseDate'])) . "</sup> " . date("F Y", strtotime($courseDetailObj['courseDate']));
     $courseDetails['date_nb'] = date("l", strtotime($courseDetailObj['courseDate'])) . " " . date("j", strtotime($courseDetailObj['courseDate'])) . "<sup>" . date("S", strtotime($courseDetailObj['courseDate'])) . "</sup> " . date("F Y", strtotime($courseDetailObj['courseDate']));
     $courseDetails['time'] = date("g:i a", strtotime($courseDetailObj['startDateTime'])) . " to " . date("g:i a", strtotime($courseDetailObj['endDateTime']));
     $courseDetails['location'] = str_replace(", ", "<br>", str_replace("\n", "<br>", $courseDetailObj['StreetAddress']));
     $courseDetails['maplink'] = "https://www.google.com.au/maps?q=" . str_replace(" ", "+", str_replace("\n", " ", $courseDetailObj['StreetAddress']));
     //var_dump($courseDetails);
     //die();
     $emailKey = sha1(date("r", strtotime("now")) . generateRandomString(5) . $bookingID . $instanceID);
     //$bookingID = "123456789-123456789";
     $viewonlinelink = "https://www.australiawidefirstaid.com.au/email/?k=" . $emailKey;
     $livedata = $enrolVar['fname'] . " " . $enrolVar['lname'] . "|" . $enrolVar['email'] . "|" . $bookingID;
     $livechatURL = "https://www.australiawidefirstaid.com.au/?livechat=true&data=" . base64_encode($livedata);
     $html = getEmailTemplate("template_CouponEmailConfirmation_generic.htm");
     $html = varReplace("bookingID", $bookingID, $html);
     $html = varReplace("emailviewlink", $viewonlinelink, $html);
     $html = varReplace("livechatURL", $livechatURL, $html);
     $html = varReplace("user.firstname", $enrolVar['fname'], $html);
     $html = varReplace("user.lastname", $enrolVar['lname'], $html);
     $html = varReplace("user.address", $enrolVar['address'], $html);
     $html = varReplace("user.suburb", $enrolVar['suburb'], $html);
     $html = varReplace("user.state", $enrolVar['state'], $html);
     $html = varReplace("user.postcode", $enrolVar['postcode'], $html);
     $html = varReplace("user.phone", $enrolVar['mobile'], $html);
     $html = varReplace("user.email", $enrolVar['email'], $html);
     $html = varReplace("user.orginisation", $enrolVar['workplace'], $html);
     $html = varReplace("course.name", $courseDetails['name'], $html);
     $html = varReplace("course.date", $courseDetails['date'], $html);
     $html = varReplace("course.date_nb", $courseDetails['date_nb'], $html);
     $html = varReplace("course.time", $courseDetails['time'], $html);
     $html = varReplace("course.location", $courseDetails['location'], $html);
     $html = varReplace("course.maplink", $courseDetails['maplink'], $html);
     $message = $html;
     $semail = "*****@*****.**";
     $sname = "Australia Wide First Aid";
     $rname = "";
     $priority = "high";
     $type = "text/html";
     $replysemail = $semail;
     $fullmessage = "";
     //$remail = "*****@*****.**";
     $remail = $enrolVar['email'];
     $subject = "First Aid Course Booking Confirmation - " . $enrolVar['fname'] . " " . $enrolVar['lname'] . " - " . $enrolVar['workplace'];
     email::logEmail($remail, "", $ccEmail, $subjet, $message, $bookingID, $instanceID, $emailKey);
     esmtp::sendemail_smtp($remail, $subject, $message, $ccEmail);
 }
コード例 #3
0
ファイル: etest.php プロジェクト: verbazend/AWFA
$resource = varReplace("order.referanceID", base64_encode($iD->INVOICEID), $resource);
$resource = varReplace("item.description", $courseDetails['name'] . "<br>[" . $iD->ITEMS[0]->ITEMCODE . "]", $resource);
$resource = varReplace("item.totalGST", "0.00", $resource);
$resource = varReplace("item.Total", $courseDetailObj['dollorAmount'] . ".00", $resource);
$resource = varReplace("order.totalGST", "0.00", $resource);
$resource = varReplace("order.Total", $courseDetailObj['dollorAmount'] . ".00", $resource);
if ($iD->ISPAID) {
    $resource = varReplace("order.amountPaid", $courseDetailObj['dollorAmount'] . ".00", $resource);
    $resource = varReplace("order.balanceDue", "0.00", $resource);
} else {
    $resource = varReplace("order.amountPaid", "0.00", $resource);
    $resource = varReplace("order.balanceDue", $courseDetailObj['dollorAmount'] . ".00", $resource);
}
$resource = varReplace("order.lastname", $iD->LASTNAME, $resource);
$resource = varReplace("order.orderID", $iD->INVOICEID, $resource);
//echo $resource;
$message = "\n\t\t\t\tHello,<br>\n\t\t\t\t<br>\n\t\t\t\tPlease note the following student has enroled online with the Les Mills Campaign.<br>\n\t\t\t\tAs of this they require a <strong>Manual</strong> invoice to be created with a \$5 Discount applied as they have chosen to pay Offline.<br>\n\t\t\t\t<br>\n\t\t\t\t<h1>Student & Booking Details</h1>\n\t\t\t\t\n\n\t\t\t\t<br>\n\t\t\t\t---------------------------------------------------<br>\n\t\t\t\t<br>\n\t\t\t\t";
$semail = "*****@*****.**";
$sname = "AWFA - Online Enrolments";
$rname = "";
$priority = "high";
$type = "text/html";
$replysemail = $semail;
$fullmessage = "";
$rname = "AWFA";
//$remail = "*****@*****.**";
$remail = "*****@*****.**";
$subject = "Les Mills Booking - Action Required for Invoicing";
esmtp::sendemail_smtp($remail, $subject, $resource);
?>
				
コード例 #4
0
ファイル: index.php プロジェクト: verbazend/AWFA
            //mail($rname."<".$remail.">", $subject, $fullmessage, $header);
        }
        if (!$enrolVar['special_needs'] == "") {
            $message = "\n\t\t\t\tHello,<br>\n\t\t\t\t<br>\n\t\t\t\tPlease note the following student has enroled online with <b>Special Needs Instructions</b>.<br>\n\t\t\t\t<br>\n\t\t\t\t---------------------------------------------------<br>\n\t\t\t\t<b>STUDENT SPECIAL NEEDS INSTRUCTIONS</b><br>\n\t\t\t\t<br>\n\t\t\t\t" . $enrolVar['special_needs'] . "\n\t\t\t\t<br>\n\t\t\t\t---------------------------------------------------<br>\n\t\t\t\t<br><br>\n\t\t\t\t<h1>Student & Booking Details</h1>\n\t\t\t\t\n\t\t\t\t<strong>Invoice ID:</strong> " . $enrollNow->INVOICEID . "  <br>\n\t\t\t\t<strong>Contact ID:</strong>  " . $enrollNow->CONTACTID . " <br>\n\t\t\t\t<strong>Learner ID:</strong>  " . $enrollNow->LEARNERID . " <br>\n\t\t\t\t<br>\n\t\t\t\t<strong>Student Name:</strong>  " . $enrolVar['fname'] . " " . $enrolVar['lname'] . "   <br>\n\t\t\t\t<strong>Course Name:</strong> " . $courseDetails['websiteName'] . "  <br>\n\t\t\t\t<strong>Course Date:</strong>  " . date('d-m-Y', strtotime($courseDetails['courseDate'])) . "  <br>\n\t\t\t\t<strong>Course Time:</strong>  " . date('h:i a', strtotime($courseDetails['startDateTime'])) . " - " . date('h:i a', strtotime($courseDetails['endDateTime'])) . "  <br>\n\t\t\t\t<strong>Course Location:</strong>  " . $courseDetails['LocationName'] . "  <br><br>\n\t\t\t\t<strong>Amount Due:</strong>  \$" . $courseCostTotal . " &nbsp;&nbsp;&nbsp;&nbsp;   (<strong>Amount Normally Due:</strong> \$" . $enrollNow->AMOUNT . ")\t<br>\n\t\t\t\t---------------------------------------------------<br>\n\t\t\t\t<br>\n\t\t\t\t";
            $semail = "*****@*****.**";
            $sname = "AWFA - Online Enrolments";
            $rname = "";
            $priority = "high";
            $type = "text/html";
            $replysemail = $semail;
            $fullmessage = "";
            $rname = "AWFA";
            //$remail = "*****@*****.**";
            $remail = "*****@*****.**";
            $subject = "Enrolment Special Needs - REF: #" . $enrollNow->LEARNERID;
            esmtp::sendemail_smtp($remail, $subject, $message);
            //esmtp::sendemail_smtp("*****@*****.**",$subject,$message);
            //mail($rname."<".$remail.">", $subject, $fullmessage, $header);
        }
    }
    //esmtp::sendemail_smtp($remail,$subject,$message);
    //$extrans_dump = "TEST EMAIL FROM WEBSITE - PLEASE IGNORE";
    //esmtp::sendemail_smtp("*****@*****.**","SYSTEM TEST",$extrans_dump);
}
$_SESSION['EnrolLocked'] = false;
/*
ob_start();
var_dump($_POST);
$extrans_dump = ob_get_clean();
ob_start();
var_dump($_GET);
コード例 #5
0
ファイル: functions.php プロジェクト: verbazend/AWFA
function sendManualInvoice($processgroupID)
{
    $emailKey = $processgroupID;
    $html = getEmailTemplate("template_invoicenotification.htm");
    $processgroupID = db::esc($processgroupID);
    $mainData = db::runQuery("select * from process_group left join events on events.instanceID = process_group.eventID left join courses on courses.courseID = events.courseID left join locations on locations.ID = events.locationID left join coupons on coupons.couponCode = process_group.campaign_code where processgroupID = '{$processgroupID}'");
    if (!$mainData) {
        return false;
    } else {
        $mData = $mainData[0];
        $courseName = $mData['CourseName'];
        $couponName = $mData['campaignName'];
        $normalCost = $mData['cost'];
        $totalTrainees = $mData['total_trainee'];
        $discountcost = $mData['totalcost'];
        $costNormalTotal = $normalCost * $totalTrainees;
        $discountcostPerperson = $discountcost / $totalTrainees;
        $amountDiscountedTot = $costNormalTotal - $discountcost;
        $invoiceItems = "";
        for ($tr = 0; $tr < $totalTrainees; $tr++) {
            $subHTML = "";
            $subHTML = $subHTML . "\t\t<tr style='font-size:13px;'>";
            $subHTML = $subHTML . "\t\t\t<td>" . $courseName . " - " . $couponName . "</td>";
            $subHTML = $subHTML . "\t\t\t<td>\$" . number_format($normalCost, 2) . "</td>";
            $subHTML = $subHTML . "\t\t\t<td>\$" . number_format($discountcostPerperson, 2) . "</td>";
            $subHTML = $subHTML . "\t\t</tr>";
            $invoiceItems = $invoiceItems . $subHTML;
        }
        $html = varReplace("invoiceItemsRow", $invoiceItems, $html);
        $html = varReplace("order.totalNormal", number_format($costNormalTotal, 2), $html);
        $html = varReplace("order.Total", number_format($discountcost, 2), $html);
        $html = varReplace("order.amountDiscounted", number_format($amountDiscountedTot, 2), $html);
        $html = varReplace("order.subTotal", number_format($discountcost, 2), $html);
        if ($mData['payment_status'] == "completed") {
            $html = varReplace("order.amountPaid", number_format($discountcost, 2), $html);
            $html = varReplace("order.balanceDue", "0.00", $html);
        } else {
            $html = varReplace("order.amountPaid", "0.00", $html);
            $html = varReplace("order.balanceDue", number_format($discountcost, 2), $html);
        }
        $html = varReplace("amountToInvoice", number_format($discountcost, 2), $html);
        $html = varReplace("eventID", $mData['eventID'], $html);
        $html = varReplace("courseName", $mData['CourseName'], $html);
        $html = varReplace("courseDateTime", $mData['startDateTime'], $html);
        $html = varReplace("courseLocation", $mData['LocationState'] . " " . $mData['LocationName'] . " - " . $mData['StreetAddress'], $html);
        $html = varReplace("totalTrainees", $mData['total_trainee'], $html);
        $html = varReplace("courseNormalCost", "\$" . number_format($costNormalTotal, 2), $html);
        $html = varReplace("couponCode", $mData['campaign_code'], $html);
        $html = varReplace("couponName", $couponName, $html);
        if ($mData['discountType'] == "0") {
            $html = varReplace("couponDiscount", "\$" . $mData['discountAmount'] . " off total", $html);
        }
        if ($mData['discountType'] == "1") {
            $html = varReplace("couponDiscount", $mData['discountAmount'] . "% off total", $html);
        }
        if ($mData['discountType'] == "2") {
            $html = varReplace("couponDiscount", "Custom price for Location", $html);
        }
        if ($mData['discountType'] == "3") {
            $html = varReplace("couponDiscount", "Custom price for Course", $html);
        }
        $trainees = db::runQuery("select * from process_trainee where processgroupID = '{$processgroupID}'");
        if (!$trainees) {
            return false;
        } else {
            $currentTrainee = 1;
            $traineehtml = "";
            foreach ($trainees as $trainee) {
                $trhtml = "";
                $trhtml = $trhtml . '<b>Trainee ' . $currentTrainee . '</b>';
                $trhtml = $trhtml . '	<table style="width:100%; margin-left:70px;">';
                $trhtml = $trhtml . '		<tr style="font-size:13px;">';
                $trhtml = $trhtml . '			<th width="30%" style="text-align:left;">Contact ID</th>';
                $trhtml = $trhtml . '			<td style="text-align:left;"><a href="https://admin.axcelerate.com.au/management/management2/Contact_View.cfm?ContactID=' . $trainee['contactID'] . '">' . $trainee['contactID'] . '</a></th>';
                $trhtml = $trhtml . '		</tr>';
                $trhtml = $trhtml . '		<tr style="font-size:13px;">';
                $trhtml = $trhtml . '			<th width="30%" style="text-align:left;">Learner ID</th>';
                $trhtml = $trhtml . '			<td style="text-align:left;">' . $trainee['leanerID'] . '</td>';
                $trhtml = $trhtml . '		</tr>';
                $trhtml = $trhtml . '		<tr style="font-size:13px;">';
                $trhtml = $trhtml . '			<th width="30%" style="text-align:left;">Invoice ID</th>';
                $trhtml = $trhtml . '			<td style="text-align:left;">' . $trainee['invoiceID'] . '</td>';
                $trhtml = $trhtml . '		</tr>';
                $trhtml = $trhtml . '		<tr style="font-size:13px;">';
                $trhtml = $trhtml . '			<th width="30%" style="text-align:left;">Amount to Invoice</th>';
                $trhtml = $trhtml . '			<td style="text-align:left;">$' . number_format($trainee['cost'], 2) . '</td>';
                $trhtml = $trhtml . '		</tr>';
                $trhtml = $trhtml . '		<tr style="font-size:13px;">';
                $trhtml = $trhtml . '			<th width="30%" style="text-align:left;">&nbsp</th>';
                $trhtml = $trhtml . '			<td style="text-align:left;"></td>';
                $trhtml = $trhtml . '		</tr>';
                $trhtml = $trhtml . '		<tr style="font-size:13px;">';
                $trhtml = $trhtml . '			<th width="30%" style="text-align:left;">Name</th>';
                $trhtml = $trhtml . '			<td style="text-align:left;">' . $trainee['firstname'] . ' ' . $trainee['lastname'] . '</td>';
                $trhtml = $trhtml . '		</tr>';
                $trhtml = $trhtml . '		<tr style="font-size:13px;">';
                $trhtml = $trhtml . '			<th width="30%" style="text-align:left;">USI</th>';
                $trhtml = $trhtml . '			<td style="text-align:left;">' . $trainee['usi'] . '</td>';
                $trhtml = $trhtml . '		</tr>';
                $trhtml = $trhtml . '		<tr style="font-size:13px;">';
                $trhtml = $trhtml . '			<th width="30%" style="text-align:left;">Email Address</th>';
                $trhtml = $trhtml . '			<td style="text-align:left;">' . $trainee['email'] . '</td>';
                $trhtml = $trhtml . '		</tr>';
                $trhtml = $trhtml . '		<tr style="font-size:13px;">';
                $trhtml = $trhtml . '			<th width="30%" style="text-align:left;">Mobile/Phone</th>';
                $trhtml = $trhtml . '			<td style="text-align:left;">' . $trainee['mobile'] . '</td>';
                $trhtml = $trhtml . '		</tr>';
                $trhtml = $trhtml . '		<tr style="font-size:13px;">';
                $trhtml = $trhtml . '			<th width="30%" style="text-align:left;">Workplace</th>';
                $trhtml = $trhtml . '			<td style="text-align:left;">' . $trainee['workplace'] . '</td>';
                $trhtml = $trhtml . '		</tr>';
                $trhtml = $trhtml . '		<tr style="font-size:13px;">';
                $trhtml = $trhtml . '			<th width="30%" style="text-align:left;">Address</th>';
                $trhtml = $trhtml . '			<td style="text-align:left;">' . $trainee['address'] . '<br>' . $trainee['suburb'] . ' ' . $trainee['postcode'] . '</td>';
                $trhtml = $trhtml . '		</tr>';
                $trhtml = $trhtml . '	</table><br><br>';
                $traineehtml = $traineehtml . $trhtml;
                $currentTrainee++;
            }
            $html = varReplace("traineeDetails", $traineehtml, $html);
            $remail = $mData['awfaSendInvoiceNotification'];
            //$remail = "*****@*****.**";
            $subject = "MANUAL INVOICE: Please generate a manual invoice for this Discounted Enrolment";
            $message = $html;
            $bookingID = "";
            $instanceID = "";
            $ccEmail = "";
            //$ccEmail = "*****@*****.**";
            email::logEmail($remail, $ccEmail, "", $subject, $message, $bookingID, $instanceID, $emailKey);
            esmtp::sendemail_smtp($remail, $subject, $message, $ccEmail);
            echo $html;
        }
    }
}