本文整理汇总了PHP中mail::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP mail::assign方法的具体用法?PHP mail::assign怎么用?PHP mail::assign使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mail
的用法示例。
在下文中一共展示了mail::assign方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OcHTMLPurifier
$purifier = new OcHTMLPurifier($opt);
$newstext = $purifier->purify($newstext);
}
$sTopic = sql_value("SELECT `name` FROM `news_topics` WHERE `id`='&1'", '', $topicid);
$tpl->assign('newstopic', $sTopic);
$tpl->assign('newstext', $newstext);
// in DB schreiben
sql("INSERT INTO `news` (`content`, `topic`, `display`) VALUES ('&1', '&2', '&3')", $newstext, $topicid, 0);
$rs = sql("SELECT `email` FROM `user` WHERE `admin`\\&'&1'='&1'", ADMIN_USER);
while ($r = sql_fetch_assoc($rs)) {
// send confirmation
$mail = new mail();
$mail->name = 'newstopic';
$mail->to = $r['email'];
$mail->subject = $translate->t('A newsentry was created on opencaching', '', basename(__FILE__), __LINE__);
$mail->assign('email', $email);
$mail->assign('newstopic', $sTopic);
$mail->assign('newstext', $newstext);
$mail->send();
}
sql_free_result($rs);
// erfolg anzeigen
$tpl->display();
exit;
}
if ($emailok != true) {
$tpl->assign('email_error', 1);
}
if ($captchaok != true) {
$tpl->assign('captcha_error', 1);
}
示例2: sql_warn
function sql_warn($warnmessage)
{
global $opt;
if ($opt['db']['error']['mail'] != '') {
if (admin_errormail($opt['db']['error']['mail'], $opt['db']['warn']['subject'], $warnmessage . "\n" . print_r(debug_backtrace(), true), "From: " . $opt['mail']['from'])) {
require_once $opt['rootpath'] . 'lib2/mail.class.php';
$mail = new mail();
$mail->name = 'sql_warn';
$mail->subject = $opt['db']['warn']['subject'];
$mail->to = $opt['db']['warn']['mail'];
$mail->assign('warnmessage', $warnmessage);
$mail->assign('trace', print_r(debug_backtrace(), true));
$mail->send();
$mail = null;
}
}
}
示例3: sendEMail
function sendEMail($nFromUserId, $sSubject, $sText, $bSendEMailAddress)
{
global $opt, $translate;
if ($this->exist() == false) {
return false;
}
if ($this->getIsActive() == false) {
return false;
}
if ($this->getEMail() === null || $this->getEMail() == '') {
return false;
}
if ($sSubject == '') {
return false;
}
if ($sText == '') {
return false;
}
if (mb_strpos($sSubject, "\n") !== false) {
$sSubject = mb_substr($sSubject, 0, mb_strpos($sSubject, "\n"));
}
$sSubject = mb_trim($sSubject);
$fromUser = new user($nFromUserId);
if ($fromUser->exist() == false) {
return false;
}
if ($fromUser->getIsActive() == false) {
return false;
}
if ($fromUser->getEMail() === null || $fromUser->getEMail() == '') {
return false;
}
$language = $this->getLanguageCode();
if (!$language) {
$language = $opt['template']['locale'];
}
// ok, we can send ...
$mail = new mail();
$mail->name = 'usercontactmail';
$mail->to = $this->getEMail();
$mail->recipient_locale = $this->getLanguageCode();
$mail->from = $opt['mail']['usermail'];
if ($bSendEMailAddress == true) {
$mail->replyTo = $fromUser->getEMail();
$mail->returnPath = $fromUser->getEMail();
}
$mail->subject = $translate->t('E-Mail from', '', basename(__FILE__), __LINE__, '', 1, $language) . ' ' . $fromUser->getUsername() . ': ' . $sSubject;
$mail->assign('usersubject', $sSubject);
$mail->assign('text', $sText);
$mail->assign('username', $this->getUsername());
$mail->assign('sendemailaddress', $bSendEMailAddress);
$mail->assign('fromusername', $fromUser->getUsername());
$mail->assign('fromuserid', $fromUser->getUserId());
$mail->assign('fromuseremail', $fromUser->getEMail());
if ($mail->send()) {
// send copy to fromUser
$mail->assign('copy', true);
$mail->to = $fromUser->getEMail();
$mail->send();
// log
sql("INSERT INTO `email_user` (`ipaddress`, \n\t\t\t `from_user_id`, \n\t\t\t `from_email`, \n\t\t\t `to_user_id`, \n\t\t\t `to_email`)\n\t\t\t VALUES ('&1', '&2', '&3', '&4', '&5')", $_SERVER["REMOTE_ADDR"], $fromUser->getUserId(), $fromUser->getEMail(), $this->getUserId(), $this->getEMail());
return true;
} else {
return false;
}
}