本文整理汇总了PHP中Mailer::build_multipart方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::build_multipart方法的具体用法?PHP Mailer::build_multipart怎么用?PHP Mailer::build_multipart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mailer
的用法示例。
在下文中一共展示了Mailer::build_multipart方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
} elseif (!$permitted) {
// make it clear to crawlers
if (Surfer::is_crawler()) {
Safe::header('Status: 401 Unauthorized', TRUE, 401);
} elseif (!Surfer::is_logged()) {
Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode(Articles::get_permalink($item)));
} elseif (isset($_REQUEST['requested']) && ($requested = Users::get($_REQUEST['requested'])) && $requested['email']) {
// prepare the mail message
$to = Mailer::encode_recipient($requested['email'], $requested['full_name']);
$subject = sprintf(i18n::c('%s: %s'), i18n::c('Request'), strip_tags($item['title']));
$message = Articles::build_notification('apply', $item, $overlay);
$headers = Mailer::set_thread('article:' . $item['id']);
// allow for skinnable template
$message = Skin::build_mail_message($message);
// build multiple parts, for HTML rendering
$message = Mailer::build_multipart($message);
// send the message to requested user
if (Mailer::post(Surfer::from(), $to, $subject, $message, NULL, $headers)) {
$text = sprintf(i18n::s('Your request has been transmitted to %s. Check your mailbox for feed-back.'), Skin::build_link(Users::get_permalink($requested), Codes::beautify_title($requested['full_name']), 'user'));
$context['text'] .= Skin::build_block($text, 'note');
}
// follow-up navigation
$context['text'] .= '<div>' . i18n::s('Where do you want to go now?') . '</div>';
$menu = array();
$menu[] = Skin::build_link($context['url_to_root'], i18n::s('Front page'), 'button');
$menu[] = Skin::build_link(Surfer::get_permalink(), i18n::s('My profile'), 'span');
$context['text'] .= Skin::finalize_list($menu, 'menu_bar');
// offer to request some owner
} else {
// provide feed-back to surfer
$context['text'] .= Skin::build_block(i18n::s('You are not allowed to access this page.'), 'caution');
示例2: implode
if (!$label) {
$to[] = $address;
} else {
if (preg_match('/,/', $label)) {
$label = implode(' ', array_reverse(preg_split("/[\\s,]+/", $label)));
}
$to[] = Mailer::encode_recipient($address, $label);
}
}
}
// subject
$subject = $_REQUEST['letter_title'];
// enable yacs codes in messages
$text = Codes::beautify($_REQUEST['letter_body']);
// preserve tagging as much as possible
$message = Mailer::build_multipart($text);
// reply-to: from the letters configuration file
if (isset($context['letter_reply_to']) && $context['letter_reply_to']) {
$headers[] = 'Reply-To: ' . $context['letter_reply_to'];
}
// list and count recipients
$recipients_errors = $recipients_processed = $recipients_ok = 0;
if (is_array($to)) {
$context['text'] .= i18n::s('A message has been sent to:') . "\n" . '<ul>' . "\n";
foreach ($to as $address) {
$context['text'] .= '<li>' . encode_field($address) . '</li>' . "\n";
}
$context['text'] .= '</ul>' . "\n";
$recipients_processed = count($to);
} elseif ($to) {
$context['text'] .= i18n::s('A message has been sent to:') . ' ' . encode_field($to) . BR . "\n";
示例3: notify
/**
* send a short email message
*
* This is the function used by yacs to notify community members of various events.
*
* @param string sender address, use default system parameter if NULL
* @param string recipient address
* @param string subject
* @param string actual message
* @param mixed to be given to Mailer::post()
* @param array to be given to Mailer::post()
* @return TRUE on success, FALSE otherwise
*
* @see agents/messages.php
* @see control/configure.php
* @see query.php
* @see shared/logger.php
* @see users/users.php
*/
public static function notify($from, $to, $subject, $message, $headers = '', $attachments = NULL)
{
global $context;
// email services have to be activated
if (!isset($context['with_email']) || $context['with_email'] != 'Y') {
return FALSE;
}
// use surfer's address only if this has been explicitly allowed
if (!isset($context['mail_from_surfer']) || $context['mail_from_surfer'] != 'Y') {
$from = NULL;
}
// ensure we have a sender
if (!$from) {
$from = Mailer::get_from_recipient();
} else {
$subject .= ' [' . $context['site_name'] . ']';
}
// allow for skinnable template
$message = Skin::build_mail_message($message);
// build multiple parts, for HTML rendering
$message = Mailer::build_multipart($message);
// do the job -- don't stop on error
if (Mailer::post($from, $to, $subject, $message, $attachments, $headers)) {
return TRUE;
}
return FALSE;
}