function send() { global $tpl, $opt, $login; if (!$this->template_exists($this->name . '.tpl')) { $tpl->error(ERROR_MAIL_TEMPLATE_NOT_FOUND); } $this->assign('template', $this->name); $optn['mail']['contact'] = $opt['mail']['contact']; $optn['page']['absolute_url'] = $opt['page']['absolute_url']; $optn['format'] = $opt['locale'][$opt['template']['locale']]['format']; $this->assign('opt', $optn); $this->assign('to', $this->to); $this->assign('from', $this->from); $this->assign('subject', $this->subject); $llogin['username'] = isset($login) ? $login->username : ''; $this->assign('login', $llogin); $body = $this->fetch($this->main_template . '.tpl', '', $this->get_compile_id()); // check if the target domain exists if the domain does not // exist, the mail is sent to the own domain (?!) $domain = mail::getToMailDomain($this->to); if (mail::is_existent_maildomain($domain) == false) { return false; } $aAddHeaders = array(); $aAddHeaders[] = 'From: "' . $this->from . '" <' . $this->from . '>'; if ($this->replyTo !== null) { $aAddHeaders[] = 'Reply-To: ' . $this->replyTo; } if ($this->returnPath !== null) { $aAddHeaders[] = 'Return-Path: ' . $this->returnPath; } $mailheaders = implode("\n", array_merge($aAddHeaders, $this->headers)); return mb_send_mail($this->to, $opt['mail']['subject'] . $this->subject, $body, $mailheaders); }
function send($page_url = false) { global $tpl, $opt; if (!$this->template_exists($this->name . '.tpl')) { $tpl->error(ERROR_MAIL_TEMPLATE_NOT_FOUND); } $this->assign('template', $this->name); if (!$this->recipient_locale) { $this->recipient_locale = $opt['template']['locale']; } $optn['mail']['contact'] = $opt['mail']['contact']; $optn['page']['absolute_url'] = $page_url ? $page_url : $opt['page']['absolute_url']; $optn['page']['sitename'] = $opt['page']['sitename']; $optn['format'] = $opt['locale'][$this->recipient_locale]['format']; $this->assign('opt', $optn); $this->assign('to', $this->to); $this->assign('from', $this->from); $this->assign('subject', $this->subject); // This is nasty, but as there is only a global translation system // (based on gettext) and there are no precompiled, language-dependend email // templates available, we must temporarily change the locale according to // the recipient's locale. If some error occurs while running fetch(), // the error message may be displayed in the recipient's language. $sender_locale = $opt['template']['locale']; if ($this->recipient_locale != $sender_locale) { $opt['template']['locale'] = $this->recipient_locale; set_php_locale(); } $body = $this->fetch($this->main_template . '.tpl', '', $this->get_compile_id()); if ($this->recipient_locale != $sender_locale) { $opt['template']['locale'] = $sender_locale; set_php_locale(); } // check if the target domain exists if the domain does not // exist, the mail is sent to the own domain (?!) $domain = mail::getToMailDomain($this->to); if (mail::is_existent_maildomain($domain) == false) { return false; } $aAddHeaders = array(); $aAddHeaders[] = 'From: "' . $this->from . '" <' . $this->from . '>'; if ($this->replyTo !== null) { $aAddHeaders[] = 'Reply-To: ' . $this->replyTo; } if ($this->returnPath !== null) { $aAddHeaders[] = 'Return-Path: ' . $this->returnPath; } $mailheaders = implode("\n", array_merge($aAddHeaders, $this->headers)); return mb_send_mail($this->to, $opt['mail']['subject'] . $this->subject, $body, $mailheaders); }