public function render() { $c = $this->content; if ($c instanceof SMlite) { $c->set($this->owner->args); $c = $c->render(); } $this->template->setHTML($this->owner->args); $this->template->setHTML('Content', $c); $this->template->set('boundary', $this->owner->boundary); return $this->template->render(); }
public function send($to, $from = null) { if (is_null($from) && isset($this->args['from'])) { $from = $this->args['from']; } if (is_null($from)) { $from = $this->app->getConfig('tmail/from'); } if (!isset($this->args['from_formatted'])) { $this->args['from_formatted'] = $from; } if (!isset($this->args['to_formatted'])) { $this->args['to_formatted'] = $to; } $from = $this->extractEmail($from); $from = $from[2]; $to = $this->extractEmail($to); $to = $to[2]; $this->render(); $body = $this->template->render(); $headers = trim($this->headers->render()); $subject = $this->args['subject']; // TODO: should we use mb_encode_mimeheader ? if (!($res = $this->hook('send', array($to, $from, $subject, $body, $headers)))) { return mail($to, $subject, $body, $headers, '-f ' . $from); } return $res; }