Esempio n. 1
0
 /**
  * Send email
  *
  * Uses the new XoopsMultiMailer
  *
  * @param $email
  * @param $subject
  * @param $body
  * @param $headers
  *
  * @return bool
  */
 public function sendMail($email, $subject, $body, $headers)
 {
     $subject = $this->encodeSubject($subject);
     $this->encodeBody($body);
     $this->multimailer->clearAllRecipients();
     $this->multimailer->addAddress($email);
     $this->multimailer->Subject = $subject;
     $this->multimailer->Body = $body;
     $this->multimailer->CharSet = $this->charSet;
     $this->multimailer->Encoding = $this->encoding;
     if (!empty($this->fromName)) {
         $this->multimailer->FromName = $this->encodeFromName($this->fromName);
     }
     if (!empty($this->fromEmail)) {
         $this->multimailer->Sender = $this->multimailer->From = $this->fromEmail;
     }
     $this->multimailer->clearCustomHeaders();
     foreach ($this->headers as $header) {
         $this->multimailer->addCustomHeader($header);
     }
     if (!$this->multimailer->send()) {
         $this->errors[] = $this->multimailer->ErrorInfo;
         return false;
     }
     return true;
 }