本文整理汇总了PHP中emailer::extra_headers方法的典型用法代码示例。如果您正苦于以下问题:PHP emailer::extra_headers方法的具体用法?PHP emailer::extra_headers怎么用?PHP emailer::extra_headers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类emailer
的用法示例。
在下文中一共展示了emailer::extra_headers方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: emailer
$board_config['smtp_host'] = @$ini_val('SMTP');
}
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
for ($i = 0; $i < count($bcc_list); $i++) {
$emailer->bcc($bcc_list[$i]);
}
$email_headers = 'X-AntiAbuse: Board servername - ' . $board_config['server_name'] . "\n";
$email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n";
$email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n";
$email_headers .= 'X-AntiAbuse: User IP - ' . decode_ip($user_ip) . "\n";
$emailer->use_template('admin_send_email');
$emailer->email_address($board_config['board_email']);
$emailer->set_subject($subject);
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'BOARD_EMAIL' => $board_config['board_email'], 'MESSAGE' => $message));
$emailer->send();
$emailer->reset();
message_die(GENERAL_MESSAGE, $lang['Email_sent'] . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.{$phpEx}?pane=right") . '">', '</a>'));
}
}
if ($error) {
$template->set_filenames(array('reg_header' => 'error_body.tpl'));
$template->assign_vars(array('ERROR_MESSAGE' => $error_msg));
$template->assign_var_from_handle('ERROR_BOX', 'reg_header');
}
//
// Initial selection
//
$sql = "SELECT group_id, group_name\r\n FROM " . GROUPS_TABLE . "\r\n WHERE group_single_user <> 1";
示例2: chaser_email
function chaser_email($sender_email, $recip_email, $subject, $message)
{
global $board_config, $phpEx, $phpbb_root_path;
global $email_headers, $user_lang;
include_once $phpbb_root_path . 'includes/emailer.' . $phpEx;
// Left in for debugging
//echo '===============================<br>';
//echo '$sender_email=',$sender_email,'<br>';
//echo '$recip_email=',$recip_email,'<br>';
//echo '$subject=',$subject,'<br>';
//echo '$message=',$message,'<br>';
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->from($sender_email);
$emailer->replyto($sender_email);
$emailer->use_template('admin_send_email', $user_lang);
$emailer->email_address($recip_email);
$emailer->set_subject($subject);
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'BOARD_EMAIL' => $board_config['board_email'], 'MESSAGE' => $message));
$emailer->send();
$emailer->reset();
}
示例3: adr_send_pm
function adr_send_pm($dest_user, $subject, $message, $check_from_id = '')
{
global $db, $phpbb_root_path, $phpEx, $lang, $user_ip, $board_config, $userdata;
$dest_user = intval($dest_user);
$msg_time = time();
$from_id = $check_from_id === '' ? intval($userdata['user_id']) : $check_from_id;
$html_on = 1;
$bbcode_on = 1;
$smilies_on = 1;
include_once $phpbb_root_path . 'includes/functions_post.' . $phpEx;
include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
$privmsg_subject = trim(strip_tags($subject));
$bbcode_uid = make_bbcode_uid();
$privmsg_message = trim(strip_tags($message));
// APM compliance
if (defined('PRIVMSGA_TABLE')) {
include_once $phpbb_root_path . 'includes/functions_messages.' . $phpEx;
send_pm(0, '', $dest_user, $privmsg_subject, $privmsg_message, '');
} else {
$sql = "SELECT user_id, user_notify_pm, user_email, user_lang, user_active\r\n\t\t\t FROM " . USERS_TABLE . "\r\n\t\t\t WHERE user_id = {$dest_user} ";
if (!($result = $db->sql_query($sql))) {
$error = TRUE;
$error_msg = $lang['No_such_user'];
}
$to_userdata = $db->sql_fetchrow($result);
$sql = "SELECT COUNT(privmsgs_id) AS inbox_items, MIN(privmsgs_date) AS oldest_post_time\r\n\t\t\tFROM " . PRIVMSGS_TABLE . "\r\n\t\t\tWHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "\r\n\t\t\t OR privmsgs_type = " . PRIVMSGS_READ_MAIL . " \r\n\t\t\t\tOR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )\r\n\t\t\tAND privmsgs_to_userid = {$dest_user} ";
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_MESSAGE, $lang['No_such_user']);
}
$sql_priority = SQL_LAYER == 'mysql' ? 'LOW_PRIORITY' : '';
if ($inbox_info = $db->sql_fetchrow($result)) {
if ($inbox_info['inbox_items'] >= $board_config['max_inbox_privmsgs']) {
$sql = "SELECT privmsgs_id FROM " . PRIVMSGS_TABLE . "\r\n\t\t\t\t\tWHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "\r\n\t\t\t\t\tOR privmsgs_type = " . PRIVMSGS_READ_MAIL . "\r\n\t\t\t\t\tOR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )\r\n\t\t\t\t\tAND privmsgs_date = " . $inbox_info['oldest_post_time'] . "\r\n\t\t\t\t\tAND privmsgs_to_userid = {$dest_user} ";
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not find oldest privmsgs (inbox)', '', __LINE__, __FILE__, $sql);
}
$old_privmsgs_id = $db->sql_fetchrow($result);
$old_privmsgs_id = $old_privmsgs_id['privmsgs_id'];
$sql = "DELETE {$sql_priority} FROM " . PRIVMSGS_TABLE . "\r\n\t\t\t\t\tWHERE privmsgs_id = {$old_privmsgs_id}";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs (inbox)' . $sql, '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE {$sql_priority} FROM " . PRIVMSGS_TEXT_TABLE . "\r\n\t\t\t\t\tWHERE privmsgs_text_id = {$old_privmsgs_id}";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs text (inbox)', '', __LINE__, __FILE__, $sql);
}
}
}
$sql_info = "INSERT INTO " . PRIVMSGS_TABLE . " \r\n\t\t\t(privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies)\r\n\t\t\tVALUES ( 1 , '" . str_replace("\\'", "''", addslashes($privmsg_subject)) . "' , " . $from_id . ", " . $to_userdata['user_id'] . ", {$msg_time}, '{$user_ip}' , {$html_on}, {$bbcode_on}, {$smilies_on})";
if (!$db->sql_query($sql_info)) {
message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs text (inbox)', '', __LINE__, __FILE__, $sql_info);
}
$privmsg_sent_id = $db->sql_nextid();
$sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text)\r\n\t\t\tVALUES ({$privmsg_sent_id}, '" . $bbcode_uid . "', '" . str_replace("\\'", "''", addslashes($privmsg_message)) . "')";
if (!$db->sql_query($sql, END_TRANSACTION)) {
message_die(GENERAL_ERROR, "Could not insert/update private message sent text.", "", __LINE__, __FILE__, $sql);
}
$sql = "UPDATE " . USERS_TABLE . "\r\n\t\t\tSET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . time() . " \r\n\t\t\tWHERE user_id = " . $to_userdata['user_id'];
if (!($status = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not update private message new/read status for user', '', __LINE__, __FILE__, $sql);
}
if ($to_userdata['user_notify_pm'] && !empty($to_userdata['user_email']) && $to_userdata['user_active']) {
// have the mail sender infos
$script_name = preg_replace('/^\\/?(.*?)\\/?$/', "\\1", trim($board_config['script_path']));
$script_name = $script_name != '' ? $script_name . '/privmsg.' . $phpEx : 'privmsg.' . $phpEx;
$server_name = trim($board_config['server_name']);
$server_protocol = $board_config['cookie_secure'] ? 'https://' : 'http://';
$server_port = $board_config['server_port'] != 80 ? ':' . trim($board_config['server_port']) . '/' : '/';
include_once $phpbb_root_path . './includes/emailer.' . $phpEx;
$emailer = new emailer($board_config['smtp_delivery']);
if ($board_config['version'] == '.0.5' || $board_config['version'] == '.0.6' || $board_config['version'] == '.0.7' || $board_config['version'] == '.0.8' || $board_config['version'] == '.0.9') {
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
$emailer->use_template('privmsg_notify', $to_userdata['user_lang']);
} else {
$email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n";
$emailer->use_template('privmsg_notify', $to_userdata['user_lang']);
$emailer->extra_headers($email_headers);
}
$emailer->email_address($to_userdata['user_email']);
$emailer->set_subject($lang['Notification_subject']);
$emailer->assign_vars(array('USERNAME' => $to_username, 'SITENAME' => $board_config['sitename'], 'EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 'U_INBOX' => $server_protocol . $server_name . $server_port . $script_name . '?folder=inbox'));
$emailer->send();
$emailer->reset();
}
}
return;
}
示例4: user_notification
function user_notification($mode, &$post_data, &$forum_id, &$topic_id, &$post_id, &$notify_user)
{
global $board_config, $lang, $db, $phpbb_root_path;
global $userdata, $user_ip;
$current_time = time();
if ($mode == 'delete') {
$delete_sql = !$post_data['first_post'] && !$post_data['last_post'] ? " AND user_id = " . $userdata['user_id'] : '';
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . " WHERE topic_id = {$topic_id}" . $delete_sql;
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not change topic notify data', '', __LINE__, __FILE__, $sql);
}
} else {
if ($mode == 'reply') {
$sql = "SELECT ban_userid \r\n\t\t\t\tFROM " . BANLIST_TABLE;
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain banlist', '', __LINE__, __FILE__, $sql);
}
$user_id_sql = '';
while ($row = $db->sql_fetchrow($result)) {
if (isset($row['ban_userid'])) {
$user_id_sql = ', ' . $row['ban_userid'];
}
}
$sql = "SELECT u.user_id, u.username, u.user_email, u.user_lang, t.topic_title \r\n\t\t\t\tFROM " . TOPICS_WATCH_TABLE . " tw, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u \r\n\t\t\t\tWHERE tw.topic_id = {$topic_id} \r\n\t\t\t\t\tAND tw.user_id NOT IN (" . $userdata['user_id'] . ", " . ANONYMOUS . $user_id_sql . " ) \r\n\t\t\t\t\tAND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . " \r\n\t\t\t\t\tAND t.topic_id = tw.topic_id \r\n\t\t\t\t\tAND u.user_id = tw.user_id";
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain list of topic watchers', '', __LINE__, __FILE__, $sql);
}
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
include $phpbb_root_path . 'includes/emailer.php';
$emailer = new emailer($board_config['smtp_delivery']);
$script_name = preg_replace('/^\\/?(.*?)\\/?$/', '\\1', trim($board_config['script_path']));
$script_name = $script_name != '' ? $script_name . '/viewtopic.php' : 'viewtopic.php';
$server_name = trim($board_config['server_name']);
$server_protocol = $board_config['cookie_secure'] ? 'https://' : 'http://';
$server_port = $board_config['server_port'] != 80 ? ':' . trim($board_config['server_port']) . '/' : '/';
$email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n";
$update_watched_sql = '';
if ($row = $db->sql_fetchrow($result)) {
@set_time_limit(120);
$topic_title = preg_replace($orig_word, $replacement_word, unprepare_message($row['topic_title']));
do {
if ($row['user_email'] != '') {
$emailer->use_template('topic_notify', $row['user_lang']);
$emailer->email_address($row['user_email']);
$emailer->set_subject();
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array('EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']), 'USERNAME' => $row['username'], 'SITENAME' => $board_config['sitename'], 'TOPIC_TITLE' => $topic_title, 'U_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_POST_URL . "={$post_id}#{$post_id}", 'U_STOP_WATCHING_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_TOPIC_URL . "={$topic_id}&unwatch=topic"));
$emailer->send();
$emailer->reset();
$update_watched_sql .= $update_watched_sql != '' ? ', ' . $row['user_id'] : $row['user_id'];
}
} while ($row = $db->sql_fetchrow($result));
}
if ($update_watched_sql != '') {
$sql = "UPDATE " . TOPICS_WATCH_TABLE . "\r\n\t\t\t\t\tSET notify_status = " . TOPIC_WATCH_NOTIFIED . "\r\n\t\t\t\t\tWHERE topic_id = {$topic_id}\r\n\t\t\t\t\t\tAND user_id IN ({$update_watched_sql})";
$db->sql_query($sql);
}
}
$sql = "SELECT topic_id \r\n\t\t\tFROM " . TOPICS_WATCH_TABLE . "\r\n\t\t\tWHERE topic_id = {$topic_id}\r\n\t\t\t\tAND user_id = " . $userdata['user_id'];
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain topic watch information', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
if (!$notify_user && !empty($row['topic_id'])) {
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "\r\n\t\t\t\tWHERE topic_id = {$topic_id}\r\n\t\t\t\t\tAND user_id = " . $userdata['user_id'];
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not delete topic watch information', '', __LINE__, __FILE__, $sql);
}
} else {
if ($notify_user && empty($row['topic_id'])) {
$sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status)\r\n\t\t\t\tVALUES (" . $userdata['user_id'] . ", {$topic_id}, 0)";
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not insert topic watch information', '', __LINE__, __FILE__, $sql);
}
}
}
}
}
示例5: _email
public function _email() {
if ($this->make) {
return;
}
if (empty($this->data['email'])) {
fatal_error();
}
if (!$this->auth['user']) {
do_login();
}
global $user, $config;
$error_msg = '';
$subject = '';
$message = '';
$current_time = time();
if (_button()) {
$subject = request_var('subject', '');
$message = request_var('message', '', true);
if (empty($subject) || empty($message)) {
$error_msg .= (($error_msg != '') ? '<br />' : '') . lang('fields_empty');
}
if (empty($error_msg)) {
$sql = 'UPDATE _artists SET last_email = ?, last_email_user = ?
WHERE ub = ?';
sql_query(sql_filter($sql, $current_time, $user->d('user_id'), $this->data['ub']));
$emailer = new emailer($config['smtp_delivery']);
$emailer->from($user->d('user_email'));
$email_headers = 'X-AntiAbuse: User_id - ' . $user->d('user_id') . nr();
$email_headers .= 'X-AntiAbuse: Username - ' . $user->d('username') . nr();
$email_headers .= 'X-AntiAbuse: User IP - ' . $user->ip . nr();
$emailer->use_template('mmg_send_email', $config['default_lang']);
$emailer->email_address($this->data['email']);
$emailer->set_subject($subject);
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array(
'SITENAME' => $config['sitename'],
'BOARD_EMAIL' => $config['board_email'],
'FROM_USERNAME' => $user->d('username'),
'UB_NAME' => $this->data['name'],
'MESSAGE' => $message
));
$emailer->send();
$emailer->reset();
redirect(s_link('a', $this->data['subdomain']));
}
}
if ($error_msg != '') {
_style('error');
}
v_style(array(
'ERROR_MESSAGE' => $error_msg,
'SUBJECT' => $subject,
'MESSAGE' => $message)
);
return;
}