本文整理汇总了PHP中mail::getToMailDomain方法的典型用法代码示例。如果您正苦于以下问题:PHP mail::getToMailDomain方法的具体用法?PHP mail::getToMailDomain怎么用?PHP mail::getToMailDomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mail
的用法示例。
在下文中一共展示了mail::getToMailDomain方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
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);
}
示例2: send
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);
}