Email.inc
3.08 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
/**
*
* Class Email
*
* Contains static functions concerned with sending emails
*
* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
* @date 19 January 2003
* @package lib.email
*/
Class Email {
/**
* Sends an email containing a hyperlink to a specified recipient
*
* @param The sender's email address
* @param The sender's Name
* @param The recipients email address
* @param The subject heading for the email
* @param The Body of the email
* @param The hyperlink that should be sent
*
* @return boolean true on email successfully sent, false otherwise and set $_SESSION["errorMessage"]
*
* @todo check for special characters (including encoding the link correctly???)
* @todo need to test this on multiple mail clients, not just Outlook
*/
function sendHyperLink($FromEmail, $FromName, $ToEmail, $Subj, $EmailBody, $hyperlink)
{
global $default;
// create a new phpmailer object.
$emailHyperlink = new phpmailer();
//set up info
$emailHyperlink->isSMTP();
$emailHyperlink->Host = $default->owl_email_server; // SMTP server
//get info from relevant fields.
$emailHyperlink->From = $FromEmail;
$emailHyperlink->FromName = $FromName;
$emailHyperlink->AddAddress($ToEmail);
$emailHyperlink->Subject = stripslashes($Subj);
$emailHyperlink->Body = stripslashes($EmailBody) . ' ' . $hyperlink;
$emailHyperlink->WordWrap = 100;
$emailHyperlink->IsHTML(true);
//send the email
if(!$emailHyperlink->Send()) {
$_SESSION["errorMessage"] = $lang_err_email . " " . $emailHyperlink->ErrorInfo;
return false;
}
return true;
}
/**
* Sends an email ment for administration,
*
* @param The sender's email address
* @param The sender's Name
* @param The recipients email address
* @param The subject heading for the email
* @param The Body of the email
* @param The hyperlink that should be sent
*
* @return boolean true on email successfully sent, false otherwise and set $_SESSION["errorMessage"]
*
* @todo check for special characters (including encoding the link correctly???)
* @todo need to test this on multiple mail clients, not just Outlook
*/
function sendHelpEmail($FromEmail, $FromName, $ToEmail, $Subj, $EmailBody, $hyperlink)
{
global $default;
// create a new phpmailer object.
$emailHyperlink = new phpmailer();
//set up info
$emailHyperlink->isSMTP();
$emailHyperlink->Host = $default->owl_email_server; // SMTP server
//get info from relevant fields.
$emailHyperlink->From = $FromEmail;
$emailHyperlink->FromName = $FromName;
$emailHyperlink->AddAddress($ToEmail);
$emailHyperlink->Subject = stripslashes($Subj) . ' ' . $hyperlink; //only difference from above
$emailHyperlink->Body = stripslashes($EmailBody) . " <br>This bug can be found on this page: " . "<a href = ". $hyperlink .">". $hyperlink ."</a>";
$emailHyperlink->WordWrap = 80;
$emailHyperlink->IsHTML(true);
//send the email
if(!$emailHyperlink->Send()) {
$_SESSION["errorMessage"] = $lang_err_email . " " . $emailHyperlink->ErrorInfo;
return false;
}
return true;
}
}
?>