Example #1
0
 /**
  * Send a plain-text email.
  *  
  * @param string $to
  * @param string $from
  * @param string §subject
  * @param string $plainContent
  * @param bool $attachedFiles
  * @param array $customheaders
  * @return bool
  */
 public function sendPlain($to, $from, $subject, $plainContent, $attachedFiles = false, $customheaders = false)
 {
     return plaintextEmail($to, $from, $subject, $plainContent, $attachedFiles, $customheaders);
 }
Example #2
0
 /**
  * @desc Send the email in plaintext
  */
 function sendPlain($messageID = null)
 {
     global $project;
     Requirements::clear();
     $this->parseVariables();
     if (empty($this->from)) {
         $this->from = Email::getAdminEmail();
     }
     $this->setBounceHandlerURL($this->bounceHandlerURL);
     $headers['X-SilverStripeBounceURL'] = $this->bounceHandlerURL;
     if ($messageID) {
         $headers['X-SilverStripeMessageID'] = $project . '.' . $messageID;
     }
     if ($project) {
         $headers['X-SilverStripeSite'] = $project;
     }
     $to = $this->to;
     $subject = $this->subject;
     if (self::$send_all_emails_to) {
         $subject .= " [addressed to {$to}";
         $to = self::$send_all_emails_to;
         if ($this->cc) {
             $subject .= ", cc to {$this->cc}";
         }
         if ($this->bcc) {
             $subject .= ", bcc to {$this->bcc}";
         }
         $usbject .= ']';
     } else {
         if ($this->cc) {
             $headers["Cc"] = $this->cc;
         }
         if ($this->bcc) {
             $headers["Bcc"] = $this->bcc;
         }
     }
     if (self::$cc_all_emails_to) {
         if (trim($headers['Cc'])) {
             $headers['Cc'] .= ', ';
         }
         $headers['Cc'] .= self::$cc_all_emails_to;
     }
     if (self::$bcc_all_emails_to) {
         if (trim($headers['Bcc'])) {
             $headers['Bcc'] .= ', ';
         }
         $headers['Bcc'] .= self::$bcc_all_emails_to;
     }
     return plaintextEmail($to, $this->from, $subject, $this->body, $this->attachments, $headers);
 }