Commit 73724c71088168fa96472f27f46ead08bf4c6d33

Authored by rob
1 parent 95d04e68

Initial revision. Contains static function for sending hyperlinks via email


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@352 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 59 additions and 0 deletions
lib/email/Email.inc 0 → 100644
  1 +<?php
  2 +
  3 +/**
  4 +* Class Email
  5 +*
  6 +* Contains static functions concerned with sending emails
  7 +*
  8 +* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  9 +* @date 19 January 2003
  10 +*/
  11 +
  12 +Class Email {
  13 +
  14 + /**
  15 + * Sends an email containing a hyperlink to a specified recipient
  16 + *
  17 + * @param The sender's email address
  18 + * @param The sender's Name
  19 + * @param The recipients email address
  20 + * @param The subject heading for the email
  21 + * @param The Body of the email
  22 + * @param The hyperlink that should be sent
  23 + *
  24 + * @return boolean true on email successfully sent, false otherwise and set $_SESSION["errorMessage"]
  25 + *
  26 + * @todo check for special characters (including encoding the link correctly???)
  27 + * @todo need to test this on multiple mail clients, not just Outlook
  28 + */
  29 + function sendHyperLink($FromEmail, $FromName, $ToEmail, $Subject, $EmailBody, $hyperlink)
  30 + {
  31 + global $default;
  32 +
  33 + // create a new phpmailer object.
  34 + $mail = new phpmailer();
  35 +
  36 + //set up info
  37 + $mail->IsSMTP(); // telling the class to use SMTP
  38 + $mail->Host = $default->owl_mail_server; // SMTP server
  39 +
  40 + //get info from relevant fields.
  41 + $mail->From = $FromEmail;
  42 + $mail->FromName = $FromName;
  43 + $mail->AddAddress($ToEmail);
  44 + $mail->Subject = $Subj;
  45 + $mail->Body = $EmailBody . ' ' . $hyperlink;
  46 + $mail->WordWrap = 100;
  47 + $mail->IsHTML(true);
  48 +
  49 + //send the email
  50 + if(!$mail->Send()) {
  51 + $_SESSION["errorMessage"] = $lang_err_email . " " . $mail->ErrorInfo;
  52 + return false;
  53 + }
  54 + return true;
  55 + }
  56 +
  57 +}
  58 +
  59 +?>
... ...