本文整理汇总了PHP中emailer::headers方法的典型用法代码示例。如果您正苦于以下问题:PHP emailer::headers方法的具体用法?PHP emailer::headers怎么用?PHP emailer::headers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类emailer
的用法示例。
在下文中一共展示了emailer::headers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: notification
function notification($sender_id, $recipient_id, $recipient_email, $email_subject, $email_text, $use_bcc = false, $pm_subject = '', $recipient_username = '', $recipient_lang = '', $emty_email_template = false)
{
global $db, $config, $user, $lang;
require IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT;
$recipient_lang = empty($recipient_lang) ? $config['default_lang'] : $recipient_lang;
// Let's do some checking to make sure that mass mail functions are working in win32 versions of php.
if (preg_match('/[c-z]:\\\\.*/i', getenv('PATH')) && !$config['smtp_delivery']) {
// We are running on windows, force delivery to use our smtp functions since php's are broken by default
$config['smtp_delivery'] = 1;
$config['smtp_host'] = @ini_get('SMTP');
}
$emailer = new emailer();
$emailer->headers('X-AntiAbuse: Board servername - ' . trim($config['server_name']));
$emailer->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
$emailer->headers('X-AntiAbuse: Username - ' . $user->data['username']);
$emailer->headers('X-AntiAbuse: User IP - ' . $user->ip);
if ($use_bcc) {
$emailer->to($config['board_email']);
$emailer->bcc($recipient_email);
} else {
$emailer->to($recipient_email);
}
$emailer->set_subject($email_subject);
if ($emty_email_template) {
$emailer->use_template('admin_send_email', $recipient_lang);
$emailer->assign_vars(array('SITENAME' => $config['sitename'], 'BOARD_EMAIL' => $config['board_email'], 'MESSAGE' => $email_text));
} else {
$server_url = create_server_url();
$privmsg_url = $server_url . CMS_PAGE_PRIVMSG;
$recipient_username = empty($recipient_username) ? $lang['User'] : $recipient_username;
$email_sig = create_signature($config['board_email_sig']);
$emailer->use_template('privmsg_notify', $recipient_lang);
$emailer->assign_vars(array('USERNAME' => $recipient_username, 'SITENAME' => $config['sitename'], 'EMAIL_SIG' => $email_sig, 'FROM' => $user->data['username'], 'DATE' => create_date($config['default_dateformat'], time(), $config['board_timezone']), 'SUBJECT' => $pm_subject, 'PRIV_MSG_TEXT' => $email_text, 'FROM_USERNAME' => $user->data['username'], 'U_INBOX' => $privmsg_url . '?folder=inbox'));
}
$emailer->send();
$emailer->reset();
return true;
}
示例2: main
function main($action)
{
global $db, $config, $template, $images, $user, $lang;
global $pafiledb_config, $debug;
$file_id = request_var('file_id', 0);
if (empty($file_id)) {
message_die(GENERAL_MESSAGE, $lang['File_not_exist']);
}
$sql = 'SELECT file_catid, file_name
FROM ' . PA_FILES_TABLE . "\n\t\t\tWHERE file_id = {$file_id}";
$result = $db->sql_query($sql);
if (!($file_data = $db->sql_fetchrow($result))) {
message_die(GENERAL_MESSAGE, $lang['File_not_exist']);
}
$db->sql_freeresult($result);
if (!$this->auth[$file_data['file_catid']]['auth_email']) {
if (!$user->data['session_logged_in']) {
redirect(append_sid(CMS_PAGE_LOGIN . '?redirect=dload.' . PHP_EXT . '&action=email&file_id=' . $file_id, true));
}
$message = sprintf($lang['Sorry_auth_email'], $this->auth[$file_data['file_catid']]['auth_email_type']);
message_die(GENERAL_MESSAGE, $message);
}
if (isset($_POST['submit'])) {
// session id check
$sid = request_post_var('sid', '');
if (empty($sid) || $sid != $user->data['session_id']) {
message_die(GENERAL_ERROR, 'INVALID_SESSION');
}
$error = false;
$femail = request_var('femail', '');
if (!empty($femail) && preg_match('/^[a-z0-9\\.\\-_\\+]+@[a-z0-9\\-_]+\\.([a-z0-9\\-_]+\\.)*?[a-z]+$/is', $femail)) {
$user_email = $femail;
} else {
$error = true;
$error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Email_invalid'] : $lang['Email_invalid'];
}
$username = request_var('fname', '', true);
$sender_name = request_var('sname', '', true);
//if (!$user->data['session_logged_in'] || ($user->data['session_logged_in'] && ($sender_name != $user->data['username'])))
if (!$user->data['session_logged_in']) {
// Mighty Gorgon: is this really needed?
/*
include(IP_ROOT_PATH . 'includes/functions_validate.' . PHP_EXT);
$result = validate_username($sender_name);
if ($result['error'])
{
$error = true;
$error_msg .= (!empty($error_msg)) ? '<br />' . $result['error_msg'] : $result['error_msg'];
}
*/
} else {
$sender_name = $user->data['username'];
}
if (!$user->data['session_logged_in']) {
$semail = request_var('semail', '');
if (!empty($semail) && preg_match('/^[a-z0-9\\.\\-_\\+]+@[a-z0-9\\-_]+\\.([a-z0-9\\-_]+\\.)*?[a-z]+$/is', $femail)) {
$sender_email = $semail;
} else {
$error = true;
$error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Email_invalid'] : $lang['Email_invalid'];
}
} else {
$sender_email = $user->data['user_email'];
}
$subject = request_var('subject', '', true);
$subject = htmlspecialchars_decode($subject, ENT_COMPAT);
if (empty($subject)) {
$error = true;
$error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Empty_subject_email'] : $lang['Empty_subject_email'];
}
$message = request_var('message', '', true);
// We need to check if HTML emails are enabled so we can correctly escape content and linebreaks
$message = !empty($config['html_email']) ? nl2br($message) : htmlspecialchars_decode($message, ENT_COMPAT);
if (empty($message)) {
$error = true;
$error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Empty_message_email'] : $lang['Empty_message_email'];
}
if (!$error) {
include IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT;
$emailer = new emailer();
$emailer->headers('X-AntiAbuse: Board servername - ' . trim($config['server_name']));
$emailer->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
$emailer->headers('X-AntiAbuse: Username - ' . $user->data['username']);
$emailer->headers('X-AntiAbuse: User IP - ' . $user_ip);
$emailer->use_template('profile_send_email', $user_lang);
$emailer->to($user_email);
$emailer->from($sender_email);
$emailer->replyto($sender_email);
$emailer->set_subject($subject);
$emailer->assign_vars(array('SITENAME' => $config['sitename'], 'BOARD_EMAIL' => $config['board_email'], 'FROM_USERNAME' => $sender_name, 'TO_USERNAME' => $username, 'MESSAGE' => $message));
$emailer->send();
$emailer->reset();
$message = $lang['Econf'] . '<br /><br />' . sprintf($lang['Click_return'], '<a href="' . append_sid('dload.' . PHP_EXT . '?action=file&file_id=' . $file_id) . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid(CMS_PAGE_HOME) . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
if ($error) {
message_die(GENERAL_MESSAGE, $error_msg);
}
}
$this->generate_category_nav($file_data['file_catid']);
//.........这里部分代码省略.........
示例3: emailer
// $e_subj = $lang['Ban_warning'];
}
} else {
$no_error = false;
}
if ($no_error) {
$sql = 'SELECT username, user_warnings, user_email, user_lang FROM ' . USERS_TABLE . ' WHERE user_id = "' . $poster_id . '"';
$result = $db->sql_query($sql);
$warning_data = $db->sql_fetchrow($result);
if (!empty($warning_data['user_email'])) {
$server_url = create_server_url();
$viewtopic_server_url = $server_url . CMS_PAGE_VIEWTOPIC;
$from_email = $user->data['user_email'] && $user->data['user_allow_viewemail'] ? $user->data['user_email'] : $config['board_email'];
include_once IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT;
$emailer = new emailer();
$emailer->headers('X-AntiAbuse: Board servername - ' . trim($config['server_name']));
$emailer->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
$emailer->headers('X-AntiAbuse: Username - ' . $user->data['username']);
$emailer->headers('X-AntiAbuse: User IP - ' . $user_ip);
$emailer->use_template($e_temp, $warning_data['user_lang']);
$emailer->to($warning_data['user_email']);
$emailer->from($from_email);
$emailer->replyto($from_email);
//$emailer->set_subject($e_subj);
$email_sig = create_signature($config['board_email_sig']);
$emailer->assign_vars(array('SITENAME' => $config['sitename'], 'WARNINGS' => $warning_data['user_warnings'], 'TOTAL_WARN' => $config['max_user_bancard'], 'POST_URL' => $viewtopic_server_url . '?' . $forum_id_append . $topic_id_append . POST_POST_URL . '=' . $post_id . '#p' . $post_id, 'EMAIL_SIG' => $email_sig, 'WARNER' => $user->data['username'], 'BLOCK_TIME' => $block_time, 'WARNED_POSTER' => $warning_data['username']));
$emailer->send();
$emailer->reset();
} else {
$message .= '<br /><br />' . $lang['user_no_email'];
}