' . $lang['Empty_subject'] : $lang['Empty_subject']; } if ( empty($message) ) { $error = true; $error_msg .= ( !empty($error_msg) ) ? '
' . $lang['Empty_message'] : $lang['Empty_message']; } $group_id = intval($HTTP_POST_VARS[POST_GROUPS_URL]); $sql = ( $group_id != -1 ) ? "SELECT u.user_email FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug WHERE ug.group_id = $group_id AND ug.user_pending <> " . TRUE . " AND u.user_id = ug.user_id" : "SELECT user_email FROM " . USERS_TABLE; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not select group members', '', __LINE__, __FILE__, $sql); } if ( $row = $db->sql_fetchrow($result) ) { $bcc_list = ''; do { $bcc_list .= ( ( $bcc_list != '' ) ? ', ' : '' ) . $row['user_email']; } while ( $row = $db->sql_fetchrow($result) ); $db->sql_freeresult($result); } else { $message = ( $group_id != -1 ) ? $lang['Group_not_exist'] : $lang['No_such_user']; $error = true; $error_msg .= ( !empty($error_msg) ) ? '
' . $message : $message; } if ( !$error ) { include($phpbb_root_path . 'includes/emailer.'.$phpEx); // // 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')) && !$board_config['smtp_delivery']) { $ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var'; // We are running on windows, force delivery to use our smtp functions // since php's are broken by default $board_config['smtp_delivery'] = 1; $board_config['smtp_host'] = @$ini_val('SMTP'); } $emailer = new emailer($board_config['smtp_delivery']); $email_headers = 'Return-Path: ' . $userdata['board_email'] . "\nFrom: " . $board_config['board_email'] . "\n"; $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"; $email_headers .= "Bcc: $bcc_list\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'] . '

' . sprintf($lang['Click_return_admin_index'], '', '')); } } 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 FROM ".GROUPS_TABLE . " WHERE group_single_user <> 1"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain list of groups', '', __LINE__, __FILE__, $sql); } $select_list = ''; // // Generate page // include('./page_header_admin.'.$phpEx); $template->set_filenames(array( 'body' => 'admin/user_email_body.tpl') ); $template->assign_vars(array( 'MESSAGE' => $message, 'SUBJECT' => $subject, 'L_EMAIL_TITLE' => $lang['Email'], 'L_EMAIL_EXPLAIN' => $lang['Mass_email_explain'], 'L_COMPOSE' => $lang['Compose'], 'L_RECIPIENTS' => $lang['Recipients'], 'L_EMAIL_SUBJECT' => $lang['Subject'], 'L_EMAIL_MSG' => $lang['Message'], 'L_EMAIL' => $lang['Email'], 'L_NOTICE' => $notice, 'S_USER_ACTION' => append_sid('admin_mass_email.'.$phpEx), 'S_GROUP_SELECT' => $select_list) ); $template->pparse('body'); include('./page_footer_admin.'.$phpEx); ?>