本文整理汇总了PHP中mailer::setSubject方法的典型用法代码示例。如果您正苦于以下问题:PHP mailer::setSubject方法的具体用法?PHP mailer::setSubject怎么用?PHP mailer::setSubject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mailer
的用法示例。
在下文中一共展示了mailer::setSubject方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Form to email a member
*
* @author Jason Warner <jason@mercuryboard.com>
* @since RC1
**/
function execute()
{
$this->set_title($this->lang->email_email);
$this->tree($this->lang->email_email);
if (!$this->perms->auth('email_use')) {
return $this->message($this->lang->email_email, $this->lang->email_no_perm);
}
if (!isset($this->post['submit'])) {
$this->get['to'] = isset($this->get['to']) ? intval($this->get['to']) : '';
if ($this->get['to']) {
$target = $this->db->fetch("SELECT user_name FROM {$this->pre}users WHERE user_id={$this->get['to']}");
if (!isset($target['user_name']) || $this->get['to'] == USER_GUEST_UID) {
return $this->message($this->lang->email_email, $this->lang->email_no_member);
}
$this->get['to'] = $target['user_name'];
}
return eval($this->template('EMAIL_MAIN'));
} else {
if (empty($this->post['to']) || empty($this->post['message']) || empty($this->post['subject'])) {
return $this->message($this->lang->email_email, $this->lang->email_no_fields);
}
$target = $this->db->fetch("SELECT user_id, user_email, user_email_form FROM {$this->pre}users WHERE user_name='{$this->post['to']}'");
if (!$target['user_email_form']) {
return $this->message($this->lang->email_email, $this->lang->email_blocked);
}
if (!isset($target['user_id']) || $target['user_id'] == USER_GUEST_UID) {
return $this->message($this->lang->email_email, $this->lang->email_no_member);
}
include './lib/mailer.php';
$mailer = new mailer($this->sets['admin_incoming'], $this->sets['admin_outgoing'], $this->sets['forum_name'], false);
$mailer->setSubject("{$this->sets['forum_name']} - {$this->post['subject']}");
$mailer->setMessage("This mail has been sent by {$this->user['user_name']} via {$this->sets['forum_name']}\n\n" . stripslashes($this->post['message']));
$mailer->setRecipient($target['user_email']);
$mailer->setServer($this->sets['mailserver']);
$mailer->doSend();
return $this->message($this->lang->email_email, $this->lang->email_sent);
}
}
示例2: array
function send_mail()
{
if (!isset($this->post['groups'])) {
$this->post['groups'] = array();
}
include '../lib/mailer.php';
$mailer = new mailer($this->sets['admin_incoming'], $this->sets['admin_outgoing'], $this->sets['forum_name'], false);
$mailer->setSubject($this->post['subject']);
$message = stripslashes($this->post['message']) . "\n";
$message .= '___________________' . "\n";
$message .= $this->sets['forum_name'] . "\n";
$message .= $this->sets['loc_of_board'] . "\n";
$mailer->setMessage($message);
$mailer->setServer($this->sets['mailserver']);
$i = 0;
$members = $this->db->query("SELECT user_email FROM {$this->pre}users" . $this->group_query($this->post['groups']));
while ($sub = $this->db->nqfetch($members)) {
$mailer->setBcc($sub['user_email']);
$i++;
}
$mailer->doSend();
return $this->message('Mass Mail', 'Your message has been sent to ' . $i . ' members.');
}
示例3: sendAlert
/**
*
* @access public
* @param id
*
*/
public function sendAlert($id)
{
$mail = new mailer();
$user = new users();
// send alert email !
$row = $user->getUser($id);
$emailTo = $row['user'];
$to[] = $emailTo;
$subject = "Alert: Hours spent have exceeded planned hours";
$mail->setSubject($subject);
$text = "Hello " . $emailTo . ",\n\t\t\t\t\t\t\t\t\n\t\t\tThis is a friendly reminder that you have surpassed\n\t\t\t\t\t\t\t\t\n\t\t\tthe estimated hours for this project. While we \n\t\t\t\t\t\t\t\t\t\n\t\t\tunderstand it is impossible to meet every deadline\n\t\t\t\t\t\t\t\t\t\n\t\t\twe encourage you to be as diligent as possible with\n\t\t\t\t\t\t\t\t\t\n\t\t\tyour workload.";
$mail->setText($text);
$mail->sendMail($to);
}
示例4: handlePost
/**
* Handle content posted by a user.
* This should be called before you try to list new participations (else, freshly submited content won't be shwown)
*
* Valid order is :
* - $this->handlePost()
* - list and display validated participations
* - show participation form ($this->render() )
*
* handlePost() does nothing if the participation form has not been submited
*
*/
function handlePost()
{
global $thinkedit;
// if form sent, validate
if ($this->form->isSent()) {
$this->content->setArray($_POST);
$valid_captcha = true;
if ($this->enable_captcha) {
require_once ROOT . '/class/captcha.class.php';
$captcha = new captcha();
if ($_REQUEST['captcha'] != $captcha->get()) {
$valid_captcha = false;
}
}
// first case : invalid content
if (!$this->content->validate() || !$valid_captcha) {
$this->form->add('<div class="participation_error">');
$this->form->add($this->invalid_message);
$this->form->add('</div>');
} else {
// if a captcha was used, reset it in order to have a new one for another message
if ($this->enable_captcha) {
$captcha->reset();
unset($_REQUEST['captcha']);
}
$failure = false;
// save content to db
if (!$this->content->insert()) {
$failure = true;
}
// add content to curent node
if (isset($this->parent_node)) {
// add content in the container
$new_node = $this->parent_node->add($this->content, 'bottom');
if (!$new_node) {
$failure = true;
}
/*
// update db
if (!$new_node->save())
{
$failure = true;
}
*/
//echo 'publish : ' . $new_node->get('publish');
// publish if needed
if ($this->enable_moderation) {
//echo 'moderation enabled';
} else {
//echo 'moderation disabled, publishing directly';
$new_node->publish();
}
//echo 'publish after : ' . $new_node->get('publish');
/*
// move to bottom of curent branch if needed
if ($this->move_to_bottom)
{
$new_node->moveBottom();
echo 'publish after move to bottom : ' . $new_node->get('publish');
}
else
{
$new_node->rebuild();
echo 'publish after rebuild : ' . $new_node->get('publish');
}
*/
}
if ($failure) {
$this->form->add('<div class="participation_error">');
$this->form->add($this->failure_message);
$this->form->add('</div>');
} else {
if (isset($this->notification_email)) {
require_once ROOT . '/class/mailer.class.php';
$mailer = new mailer();
$mailer->isHtml(true);
$mailer->setTo($this->notification_email);
// todo : find the first email field type in the record to use it as a sender
// $mailer->setFrom($this->notification_email);
$mailer->setSubject($this->notification_email_subject . $this->content->getTitle());
$message = '';
foreach ($this->content->field as $field) {
$message .= '<b>' . $field->getTitle();
$message .= ' : ' . '</b>';
$message .= '<br/>';
$message .= $field->get();
$message .= '<br/>';
$message .= '<br/>';
//.........这里部分代码省略.........
示例5: mailer
function request_pass()
{
$this->set_title($this->lang->login_pass_reset);
$this->tree($this->lang->login_pass_reset);
if (!isset($this->get['e'])) {
$this->get['e'] = null;
}
$target = $this->db->fetch("SELECT user_id, user_name, user_email FROM {$this->pre}users WHERE MD5(CONCAT(user_email, user_name, user_password, user_joined))='" . preg_replace('/[^a-z0-9]/', '', $this->get['e']) . '\' AND user_id != ' . USER_GUEST_UID . ' LIMIT 1');
if (!isset($target['user_id'])) {
return $this->message($this->lang->login_pass_reset, $this->lang->login_pass_no_id);
}
include './lib/mailer.php';
$mailer = new mailer($this->sets['admin_incoming'], $this->sets['admin_outgoing'], $this->sets['forum_name'], false);
$newpass = $this->generate_pass(8);
$message = "{$this->sets['forum_name']}\n\n";
$message .= "Your password has been reset to:\n{$newpass}\n\n";
$message .= "{$this->sets['loc_of_board']}{$this->mainfile}?a=login";
$mailer->setSubject("{$this->sets['forum_name']} - Reset Password");
$mailer->setMessage($message);
$mailer->setRecipient($target['user_email']);
$mailer->setServer($this->sets['mailserver']);
$mailer->doSend();
$this->db->query("UPDATE {$this->pre}users SET user_password='" . md5($newpass) . "' WHERE user_id={$target['user_id']}");
return $this->message($this->lang->login_pass_reset, $this->lang->login_pass_sent);
}
示例6: makePost
//.........这里部分代码省略.........
if (!isset($this->post['icon'])) {
$this->post['icon'] = '';
}
if (!isset($this->post['parseCode'])) {
$this->post['parseCode'] = 0;
}
if (!isset($this->post['parseEmot'])) {
$this->post['parseEmot'] = 0;
}
if ($this->post['parseCode'] && !$this->quote_check($this->post['post'])) {
$this->post['parseCode'] = 0;
}
if ($s == 'topic' || $s == 'poll') {
$mode = 0;
if ($this->perms->auth('topic_global') && isset($this->post['global_topic'])) {
$mode |= TOPIC_GLOBAL;
}
if (trim($this->post['title']) == '') {
return $this->message($this->lang->post_posting, $this->lang->post_must_title);
}
if ($s == 'poll') {
if (trim($this->post['options']) == '') {
return $this->message($this->lang->post_posting, $this->lang->post_must_options);
}
$max_options = 15;
$option_count = substr_count($this->post['options'], "\n") + 1;
if ($option_count > $max_options || $option_count < 2) {
return $this->message($this->lang->post_posting, sprintf($this->lang->post_too_many_options, $max_options));
}
}
$this->sets['topics']++;
if ($s != 'poll') {
$this->db->query("INSERT INTO {$this->pre}topics (topic_title, topic_forum, topic_description, topic_starter, topic_icon, topic_edited, topic_last_poster, topic_modes) VALUES ('{$this->post['title']}', {$this->get['f']}, '{$this->post['desc']}', {$this->user['user_id']}, '{$this->post['icon']}', {$this->time}, {$this->user['user_id']}, {$mode})");
} else {
$mode |= TOPIC_POLL;
$this->db->query("INSERT INTO {$this->pre}topics (topic_title, topic_forum, topic_description, topic_starter, topic_icon, topic_edited, topic_last_poster, topic_modes, topic_poll_options) VALUES ('{$this->post['title']}', {$this->get['f']}, '{$this->post['desc']}', {$this->user['user_id']}, '{$this->post['icon']}', {$this->time}, {$this->user['user_id']}, {$mode}, '{$this->post['options']}')");
}
$this->get['t'] = $this->db->insert_id();
}
$newlevel = $this->get_level($this->user['user_posts'] + 1);
if ($this->user['user_title_custom']) {
$membertitle = $this->user['user_title'];
} else {
$membertitle = $newlevel['user_title'];
}
$this->sets['posts']++;
$this->write_sets();
/*
if (isset($this->post['rich'])) {
$this->post['post'] = $this->format_html_mbcode($this->post['post']);
}
*/
$this->db->query("INSERT INTO {$this->pre}posts (post_topic, post_author, post_text, post_time, post_emoticons, post_mbcode, post_ip, post_icon) VALUES ({$this->get['t']}, {$this->user['user_id']}, '{$this->post['post']}', {$this->time}, {$this->post['parseEmot']}, {$this->post['parseCode']}, INET_ATON('{$this->ip}'), '{$this->post['icon']}')");
$post_id = $this->db->insert_id();
$this->db->query("UPDATE {$this->pre}users SET user_posts=user_posts+1, user_lastpost='{$this->time}', user_level='{$newlevel['user_level']}', user_title='" . addslashes($membertitle) . "' WHERE user_id='{$this->user['user_id']}'");
if ($s == 'reply') {
$this->db->query("UPDATE {$this->pre}topics SET topic_replies=topic_replies+1, topic_edited={$this->time}, topic_last_poster={$this->user['user_id']} WHERE topic_id={$this->get['t']}");
$field = 'forum_replies';
} else {
$field = 'forum_topics';
}
// Update all parent forums if any
$forums = $this->db->fetch("SELECT forum_tree FROM {$this->pre}forums WHERE forum_id={$this->get['f']}");
$this->db->query("UPDATE {$this->pre}forums SET {$field}={$field}+1, forum_lastpost={$post_id} WHERE forum_parent > 0 AND forum_id IN ({$forums['forum_tree']}) OR forum_id={$this->get['f']}");
if (isset($this->post['attached_data']) && $this->perms->auth('post_attach', $this->get['f'])) {
$this->attachmentutil->insert($post_id, $this->post['attached_data']);
}
$this->db->query("DELETE FROM {$this->pre}subscriptions WHERE subscription_expire < {$this->time}");
$subs = $this->db->query("\n\t\t\tSELECT\n\t\t\t u.user_email\n\t\t\tFROM\n\t\t\t {$this->pre}subscriptions s,\n\t\t\t {$this->pre}users u\n\t\t\tWHERE\n\t\t\t s.subscription_user = u.user_id AND\n\t\t\t u.user_id != {$this->user['user_id']} AND\n\t\t\t ((s.subscription_type = 'topic' AND s.subscription_item = {$this->get['t']}) OR\n\t\t\t (s.subscription_type = 'forum' AND s.subscription_item = {$this->get['f']}))");
if ($this->db->num_rows($subs)) {
$emailtopic = $this->db->fetch("\n\t\t\t\tSELECT\n\t\t\t\t\tt.topic_title,\n\t\t\t\t\tf.forum_name\n\t\t\t\tFROM\n\t\t\t\t\t{$this->pre}topics t,\n\t\t\t\t\t{$this->pre}forums f\n\t\t\t\tWHERE\n\t\t\t\t\tt.topic_id={$this->get['t']} AND\n\t\t\t\t\tt.topic_forum=f.forum_id");
$message = "{$this->sets['forum_name']}\n";
$message .= "{$this->sets['loc_of_board']}{$this->mainfile}?a=topic&t={$this->get['t']}\n\n";
$message .= "A new post has been made in a topic or forum you are subscribed to.\n\n";
$message .= "Forum: {$emailtopic['forum_name']}\n";
$message .= "Topic: " . $this->format($emailtopic['topic_title'], FORMAT_CENSOR);
include './lib/mailer.php';
$mailer = new mailer($this->sets['admin_incoming'], $this->sets['admin_outgoing'], $this->sets['forum_name'], false);
$mailer->setSubject("{$this->sets['forum_name']} - Subscriptions");
$mailer->setMessage($message);
$mailer->setServer($this->sets['mailserver']);
while ($sub = $this->db->nqfetch($subs)) {
$mailer->setBcc($sub['user_email']);
}
$mailer->doSend();
}
if ($s == 'reply') {
$topic['topic_replies']++;
if ($topic['topic_replies'] >= $this->sets['posts_per_page']) {
$min = floor($topic['topic_replies'] / $this->sets['posts_per_page']) * $this->sets['posts_per_page'];
$jump = "&min={$min}#p" . ($topic['topic_replies'] - $min);
} else {
$jump = '#p' . $topic['topic_replies'];
}
header('Location: ' . $this->self . '?a=topic&t=' . $this->get['t'] . $jump);
} else {
header('Location: ' . $this->self . '?a=topic&t=' . $this->get['t']);
}
}
}
示例7: mailer
function send_activation_email($email, $username, $pass, $jointime)
{
include './lib/mailer.php';
$mailer = new mailer($this->sets['admin_incoming'], $this->sets['admin_outgoing'], $this->sets['forum_name'], false);
$message = "{$this->lang->register_email_msg}\n";
$message .= "{$this->lang->register_email_msg2} {$this->sets['forum_name']}.\n\n";
$message .= "{$this->lang->register_email_msg3}\n";
$message .= "{$this->sets['loc_of_board']}{$this->mainfile}?a=register&s=activate&e=" . md5($email . $username . $pass . $jointime);
$mailer->setSubject("{$this->sets['forum_name']} - {$this->lang->register_activating}");
$mailer->setMessage($message);
$mailer->setRecipient($email);
$mailer->setServer($this->sets['mailserver']);
$mailer->doSend();
return $this->message($this->lang->register_reging, sprintf($this->lang->register_must_activate, $email));
}
示例8: mailer
function send_activation_email($email, $username, $pass, $jointime)
{
include './lib/mailer.php';
$mailer = new mailer($this->sets['admin_incoming'], $this->sets['admin_outgoing'], $this->sets['forum_name'], false);
$message = "This is an automated email generated by MercuryBoard, and sent to you in order\n";
$message .= "for you to activate your account with {$this->sets['forum_name']}.\n\n";
$message .= "Please click the following link, or paste it in to your web browser:\n";
$message .= "{$this->sets['loc_of_board']}{$this->self}?a=register&s=activate&e=" . md5($email . $username . $pass . $jointime);
$mailer->setSubject("{$this->sets['forum_name']} - Activating Your Account");
$mailer->setMessage($message);
$mailer->setRecipient($email);
$mailer->setServer($this->sets['mailserver']);
$mailer->doSend();
return $this->message($this->lang->register_reging, sprintf($this->lang->register_must_activate, $email));
}