1<?php 2 3namespace splitbrain\dokuwiki\plugin\smtp; 4 5/** 6 * Class Message 7 * 8 * Overrides the Message class with what we need to reuse the SMTP mailer without using 9 * their message composer 10 * 11 * @package splitbrain\dokuwiki\plugin\smtp 12 */ 13class Message extends \Tx\Mailer\Message { 14 15 protected $from; 16 protected $to; 17 protected $body; 18 19 /** 20 * @param $from 21 * @param $to 22 * @param $body 23 */ 24 public function __construct($from, $to, $body) { 25 $this->from = $from; 26 $this->to = $to; 27 $this->body = $body; 28 } 29 30 /** 31 * @return string 32 */ 33 public function getFromEmail() { 34 return $this->from; 35 } 36 37 /** 38 * @return array 39 */ 40 public function getTo() { 41 $rcpt = explode(',', $this->to); //FIXME this needs to be improved 42 $rcpt = array_filter($rcpt); 43 $rcpt = array_unique($rcpt); 44 return $rcpt; 45 } 46 47 /** 48 * @return string 49 */ 50 public function toString() { 51 // FIXME we need to remove the BCC fields here 52 53 return $this->body . $this->CRLF . $this->CRLF . "." . $this->CRLF; 54 } 55 56} 57