-
Notifications
You must be signed in to change notification settings - Fork 0
/
emailManagerTester.php
52 lines (44 loc) · 2.24 KB
/
emailManagerTester.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
include("includes/emailManager.php");
include("/home/uff/public_html/intranet/includes/conn.php");
//constructor has default parameters
//database, log level, enable email sending
$mailer = new Emailer($CDB, Emailer::$LOG_FULL, true);
//database, LOG PARTIAL, enable email sending
//$mailer = new Emailer($CDB);
//optionally set the file execution comment
//allows easier differentiation between file runs if set correctly
//if not set, it includes timestamp, log level, and filename
$mailer->set_file_execution_comment("This file is being run on " . date("Y-m-d H:i:s") . " to import data.");
//enable debug mode (also lets you set the file execution comment)
//it will overwrite any previous comments
//it stops emails from being sent and turns on full debugging mode
$mailer->enable_debug_mode("This file is being debugged by Jeremian");
//set headers
$headers = "";
$headers .= "From: uInterview <[email protected]>\n";
$headers .= "X-Mailer: PHP\n";
$headers .= "Return-Path: <[email protected]>\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\n";
$headers .= "bcc: [email protected] <[email protected]>";
$mailer->set_default_headers($headers);
//if using the mail manager to compose the message:
$mailer->set_default_email_header_and_footer("This is the header of your email", "This is the footer of your email");
$message = $mailer->compose_message("This is the body of your email");
$to = "[email protected]";
$subject = "test of the mail system";
//the debug array can have almost anything in it
$debug_array = array("interviewID" => "2010100721593764");
//send mail immediately
$mailer->send_email_with_default_headers($to, $subject, $message, $debug_array);
//queue multiple messages for mailing later
//only sends queued mail from the current file and execution
$mailer->send_email_with_default_headers($to, $subject, $message, $debug_array);
$mailer->send_email_with_default_headers($to2, $subject2, $message2, $debug_array2);
$mailer->send_email_with_default_headers($to3, $subject2, $message3, $debug_array3);
$mailer->send_all_queued_email();
//use different headers
$mailer->send_email($to, $subject, $message, $other_headers, $debug_array);
$mailer->queue_email($to, $subject, $message, $other_headers, $debug_array);
$mailer->send_all_queued_email();
?>