Ejemplo n.º 1
0
 /**
  * Send an email
  * 
  * @param string $from        Self explanatory
  * @param string $to          Self explanatory
  * @param string $subject     Self explanatory
  * @param string $text        Self explanatory
  * @param string $html        Self explanatory
  * @param array  $attachments Self explanatory
  * 
  * @return boolean
  */
 function send($from = "", $to = "", $subject = "", $text = "", $html = "", $attachments = array())
 {
     $email = new imEMail($from, $to, $subject, "utf-8");
     $email->setText($text);
     $email->setHTML($this->header . $this->styleHTML($html) . $this->footer);
     $email->setStandardType($this->emailType);
     foreach ($attachments as $a) {
         if (isset($a['name']) && isset($a['content']) && isset($a['mime'])) {
             $email->attachFile($a['name'], $a['content'], $a['mime']);
         }
     }
     return $email->send();
 }
Ejemplo n.º 2
0
 /**
  * Send an email
  * 
  * @param string $from        Self explanatory
  * @param string $to          Self explanatory
  * @param string $subject     Self explanatory
  * @param string $text        Self explanatory
  * @param string $html        Self explanatory
  * @param array  $attachments Self explanatory
  * 
  * @return boolean
  */
 function send($from = "", $to = "", $subject = "", $text = "", $html = "", $attachments = array())
 {
     /*
             |--------------
             |  PHPMailer
             |--------------
     */
     if ($this->emailType == 'phpmailer') {
         require_once "PHPMailerAutoload.php";
         $email = new PHPMailer();
         // SMTP support
         if ($this->use_smtp) {
             $email->isSMTP();
             $email->Host = $this->smtp_host;
             if ($this->smtp_encryption != 'none') {
                 $email->SMTPSecure = $this->smtp_encryption;
             }
             $email->SMTPAuth = $this->use_smtp_auth;
             if ($this->use_smtp_auth) {
                 $email->Username = $this->smtp_username;
                 $email->Password = $this->smtp_password;
             }
         }
         // Meta
         $email->CharSet = 'UTF-8';
         // WSXELE-1067: Force UTF-8
         $email->Subject = $subject;
         $email->From = $from;
         $email->FromName = $from;
         $email->addAddress($to, $to);
         // Content
         $email->isHTML(true);
         $email->Body = $this->header . $this->styleHTML($html) . $this->footer;
         $email->AltBody = $text;
         // Attachments
         foreach ($attachments as $file) {
             if (isset($file['name']) && isset($file['content']) && isset($file['mime'])) {
                 $email->addStringAttachment($file['content'], $file['name'], 'base64', $file['mime'], 'attachment');
             }
         }
         if (!$email->send()) {
             $this->registerLog($email->ErrorInfo);
             return false;
         }
         return true;
     }
     /*
             |--------------
             |  WSX5 class
             |--------------
     */
     $email = new imEMail($from, $to, $subject, "utf-8");
     $email->setExpose($this->exposeWsx5);
     $email->setText($text);
     $email->setHTML($this->header . $this->styleHTML($html) . $this->footer);
     $email->setStandardType($this->emailType);
     foreach ($attachments as $a) {
         if (isset($a['name']) && isset($a['content']) && isset($a['mime'])) {
             $email->attachFile($a['name'], $a['content'], $a['mime']);
         }
     }
     if (!$email->send()) {
         $this->registerLog("Cannot send email with internal script");
         return false;
     }
     return true;
 }
Ejemplo n.º 3
0
 /**
  * Send an email
  * 
  * @param string $from        Self explanatory
  * @param string $to          Self explanatory
  * @param string $subject     Self explanatory
  * @param string $text        Self explanatory
  * @param string $html        Self explanatory
  * @param array  $attachments Self explanatory
  * 
  * @return boolean
  */
 function send($from = "", $to = "", $subject = "", $text = "", $html = "", $attachments = array())
 {
     /*
             |--------------
             |  PHPMailer
             |--------------
     */
     if ($this->emailType == 'phpmailer') {
         require_once "PHPMailerAutoload.php";
         $email = new PHPMailer();
         // SMTP support
         if ($this->use_smtp) {
             $email->isSMTP();
             $email->Host = $this->smtp_host;
             $email->Port = $this->smtp_port;
             if ($this->smtp_encryption != 'none') {
                 $email->SMTPSecure = $this->smtp_encryption;
             }
             $email->SMTPAuth = $this->use_smtp_auth;
             if ($this->use_smtp_auth) {
                 $email->Username = $this->smtp_username;
                 $email->Password = $this->smtp_password;
             }
         }
         // Meta
         $email->CharSet = 'UTF-8';
         // WSXELE-1067: Force UTF-8
         $email->Subject = $subject;
         $email->From = addressFromEmail($from);
         $email->FromName = nameFromEmail($from);
         // WSXELE-1120: Split the email addresses if necessary
         $to = str_replace(";", ",", $to);
         // Make sure it works for both "," and ";" separators
         foreach (explode(",", $to) as $addr) {
             // WSXELE-1157: Provide support for the format John Doe <*****@*****.**>
             $email->addAddress(addressFromEmail($addr), nameFromEmail($addr));
         }
         // Content
         $email->isHTML(true);
         $email->Body = $this->header . $this->styleHTML($html) . $this->footer;
         $email->AltBody = $text;
         // Attachments
         foreach ($attachments as $file) {
             if (isset($file['name']) && isset($file['content']) && isset($file['mime'])) {
                 $email->addStringAttachment($file['content'], $file['name'], 'base64', $file['mime'], 'attachment');
             }
         }
         if (!$email->send()) {
             $this->registerLog($email->ErrorInfo);
             return false;
         }
         return true;
     }
     /*
             |--------------
             |  WSX5 class
             |--------------
     */
     $email = new imEMail($from, $to, $subject, "utf-8");
     $email->setExpose($this->exposeWsx5);
     $email->setText($text);
     $email->setHTML($this->header . $this->styleHTML($html) . $this->footer);
     $email->setStandardType($this->emailType);
     foreach ($attachments as $a) {
         if (isset($a['name']) && isset($a['content']) && isset($a['mime'])) {
             $email->attachFile($a['name'], $a['content'], $a['mime']);
         }
     }
     if (!$email->send()) {
         $this->registerLog("Cannot send email with internal script");
         return false;
     }
     return true;
 }