$emailaddress) return $this->$emailaddress; return $this->$emailaddress = $database->createModel('EmailAddress', $this->activerow->ref('emailaddress')); } private $mailing; public function getMailing() { if($this->mailing) return $this->mailing; return $this->mailing = $this->database->createModel('Mailing', $this->activerow->ref('mailing')); } public function getAddress() { return $this->activerow->actual_emailaddress; } public function getSent() { return $this->activerow->sent_when; } public function setSent($value = null) { if(is_null($value)) $value = new \DateTime; $this->activerow->update(['sent_when' => $value]); } public function getLast_bounce() { return $this->activerow->last_bounce; } public function getLast_bounce_received_when() { return $this->activerow->last_bounce_received_when; } public function setLast_bounce($value) { $this->activerow->update(['last_bounce' => $value, 'last_bounce_received_when' => new \DateTime]); } public function getVerp() { return $this->activerow->verp; } public function getBody() { return $this->getMailing()->body; } public function getSubject() { return $this->getMailing()->subject; } public function getFrom() { return $this->getMailing()->from; } public function getFromname() { return $this->getMailing()->fromname; } public function getFromemail() { return $this->getMailing()->fromemail; } public function getAttachments() { return $this->getMailing()->attachments; } public function as_message() { $message = $this->getMailing()->as_message(); $verp = $this->getVerp(); $cfg = $this->cfg; $escaped_verp = preg_replace('/[\\$]/', '\$0', $verp); # g modifier is default # $envelope_from = preg_replace('/^(.*)(@[^@]+)$/', "\$1$escaped_verp\$2", $cfg->bounce_address, 1, $success); $envelope_from = preg_replace('/@/', "$escaped_verp@", $cfg->bounce_address, 1, $success); if(!$success) throw new \ErrorException("unable to parse bounce_address setting"); $message->setEnvelopeFrom($envelope_from) ->addTo($this->getAddress() ->setHeader('Message-ID', "<$verp@$cfg->messageid_host>"); return $message; } }