Commit 70b89b59d3ab7b8ab7c38326e9798d385cbf8da8

Authored by mukhtar
1 parent 972f86d5

added email function for the help page


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@581 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 57 additions and 14 deletions
lib/email/Email.inc
1 1 <?php
2 2  
  3 +
3 4 /**
4 5 *
5 6 * Class Email
... ... @@ -12,6 +13,7 @@
12 13 */
13 14  
14 15 Class Email {
  16 +
15 17  
16 18 /**
17 19 * Sends an email containing a hyperlink to a specified recipient
... ... @@ -28,34 +30,75 @@ Class Email {
28 30 * @todo check for special characters (including encoding the link correctly???)
29 31 * @todo need to test this on multiple mail clients, not just Outlook
30 32 */
31   - function sendHyperLink($FromEmail, $FromName, $ToEmail, $Subject, $EmailBody, $hyperlink)
  33 + function sendHyperLink($FromEmail, $FromName, $ToEmail, $Subj, $EmailBody, $hyperlink)
32 34 {
33 35 global $default;
34 36  
35 37 // create a new phpmailer object.
36   - $mail = new phpmailer();
  38 + $emailHyperlink = new phpmailer();
37 39  
38 40 //set up info
39   - $mail->IsSMTP(); // telling the class to use SMTP
40   - $mail->Host = $default->owl_mail_server; // SMTP server
  41 + $emailHyperlink->isSMTP();
  42 + $emailHyperlink->Host = $default->owl_mail_server; // SMTP server
41 43  
42 44 //get info from relevant fields.
43   - $mail->From = $FromEmail;
44   - $mail->FromName = $FromName;
45   - $mail->AddAddress($ToEmail);
46   - $mail->Subject = $Subj;
47   - $mail->Body = $EmailBody . ' ' . $hyperlink;
48   - $mail->WordWrap = 100;
49   - $mail->IsHTML(true);
  45 + $emailHyperlink->From = $FromEmail;
  46 + $emailHyperlink->FromName = $FromName;
  47 + $emailHyperlink->AddAddress($ToEmail);
  48 + $emailHyperlink->Subject = $Subj;
  49 + $emailHyperlink->Body = stripslashes($EmailBody) . ' ' . $hyperlink;
  50 + $emailHyperlink->WordWrap = 100;
  51 + $emailHyperlink->IsHTML(true);
50 52  
51 53 //send the email
52   - if(!$mail->Send()) {
53   - $_SESSION["errorMessage"] = $lang_err_email . " " . $mail->ErrorInfo;
  54 + if(!$emailHyperlink->Send()) {
  55 + $_SESSION["errorMessage"] = $lang_err_email . " " . $emailHyperlink->ErrorInfo;
  56 + return false;
  57 + }
  58 + return true;
  59 + }
  60 + /**
  61 + * Sends an email ment for administration,
  62 + *
  63 + * @param The sender's email address
  64 + * @param The sender's Name
  65 + * @param The recipients email address
  66 + * @param The subject heading for the email
  67 + * @param The Body of the email
  68 + * @param The hyperlink that should be sent
  69 + *
  70 + * @return boolean true on email successfully sent, false otherwise and set $_SESSION["errorMessage"]
  71 + *
  72 + * @todo check for special characters (including encoding the link correctly???)
  73 + * @todo need to test this on multiple mail clients, not just Outlook
  74 + */
  75 + function sendHelpEmail($FromEmail, $FromName, $ToEmail, $Subj, $EmailBody, $hyperlink)
  76 + {
  77 + global $default;
  78 +
  79 + // create a new phpmailer object.
  80 + $emailHyperlink = new phpmailer();
  81 +
  82 + //set up info
  83 + $emailHyperlink->isSMTP();
  84 + $emailHyperlink->Host = $default->owl_mail_server; // SMTP server
  85 +
  86 + //get info from relevant fields.
  87 + $emailHyperlink->From = $FromEmail;
  88 + $emailHyperlink->FromName = $FromName;
  89 + $emailHyperlink->AddAddress($ToEmail);
  90 + $emailHyperlink->Subject = $Subj . ' ' . $hyperlink; //only difference from above
  91 + $emailHyperlink->Body = stripslashes($EmailBody) . " <br>This bug can be found on this page: " . "<a href = ". $hyperlink .">" . $hyperlink . "</a>";
  92 + $emailHyperlink->WordWrap = 80;
  93 + $emailHyperlink->IsHTML(true);
  94 +
  95 + //send the email
  96 + if(!$emailHyperlink->Send()) {
  97 + $_SESSION["errorMessage"] = $lang_err_email . " " . $emailHyperlink->ErrorInfo;
54 98 return false;
55 99 }
56 100 return true;
57 101 }
58   -
59 102 }
60 103  
61 104 ?>
... ...