Mass Mail

Frågor kring MODdar (modifikationer) för phpBB 2.0.x.

Moderatorer: Moderatorgrupp, Supportgrupp

KimEdstrom
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 104
Blev medlem: 2006-03-14 17:51
Svar: 0
Kontakt:

Mass Mail

Inlägg av KimEdstrom »

Jag fick just en ide om varför jag får debug emailer.php errors osv..
Jag letade igenom detta forum lite och hittade länkar om Mass Mail och tänkte att jag kan ju alltid testa.. Så när jag ska installera modden och ska hitta den här delen av scriptet i admin/admin_mass_email.php.

Kod: Markera allt

      $bcc_list = '';
      do
      {
         $bcc_list .= ( ( $bcc_list != '' ) ? ', ' : '' ) . $row['user_email'];
      }
      while ( $row = $db->sql_fetchrow($result) );
Får jag svaret att den inte kan hitta det. Jag kortar av scriptet och söker på olika delar av scriptet i den filen men den finns fortfarande inte..

Nån som tror sig ha någon ide om vad jag kan göra?
Det spelar ingen roll om jag får php mailen att funka eller om jag använder mass mail modden. Vill mest bli av med alla errors. Och vore lite kul om jag fick email activation av accounten att fungera också.

Uppskattar all hjälp och alla tankar om vad jag kan testa.

//
Kim
Senast redigerad av KimEdstrom den 2006-07-16 18:44, redigerad totalt 1 gånger.
KimEdstrom
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 104
Blev medlem: 2006-03-14 17:51
Svar: 0
Kontakt:

Inlägg av KimEdstrom »

##############################################################
## MOD Title: Split Mass Mail in Chunks
## MOD Author: R. U. Serious <r.u.serious@handykoelsch.de> http://www.handykoelsch.de
## MOD Description: This MOD relates to the Admin-Mass-Mail function.
## Instead of sending a single email with all recipients as BCC,
## it will split the mail up in several emails each with 100 users in
## the BCC-field. This is to work around problems for larger boards
## to send mass mail.
## MOD Version: 0.9.2
##
## Installation Level: easy
## Installation Time: 6 Minutes
## Files To Edit: admin_mass_email.php, templates/subSilver/admin/user_email_body.tpl
## Included Files: n/a
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Author Notes: When using the massmail-feature, It will take quite a while to process.
## Do _NOT_ resubmit the form, just wait... ;)
##
##
## Version History: 0.9.2 Fixed Problem that it's only refreshing.
## 0.9.1 Added Javascript to prevent re-submission of form
## 0.9.0 Initial version
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]------------------------------------------
#
admin/admin_mass_email.php

#
#-----[ FIND ]------------------------------------------
#
if ( isset($HTTP_POST_VARS['submit']) )

#
#-----[ REPLACE ]------------------------------------------
#
if ( isset($HTTP_POST_VARS['message']) || isset($HTTP_POST_VARS['subject']) )

#
#-----[ FIND ]------------------------------------------
#
$bcc_list = '';
do
{
$bcc_list .= ( ( $bcc_list != '' ) ? ', ' : '' ) . $row['user_email'];
}
while ( $row = $db->sql_fetchrow($result) );


#
#-----[ REPLACE ]------------------------------------------
#
$bcc_list = array();$j=0;
$bcc_list[0] = $row['user_email'];
for ($i = 1;;$i++)
{
if ( !( $row = $db->sql_fetchrow($result)) ) break;
$bcc_list[$j] .= ( ( $bcc_list[$j] != '' ) ? ', ' : '' ) . $row['user_email'];
if (($i % 100) == 0 ) $j++;
}


#
#-----[ FIND ]------------------------------------------
#
$emailer = new emailer($board_config['smtp_delivery']);

#
#-----[ BEFORE, ADD ]------------------------------------------
#
for ($i = 0; $i < count($bcc_list);$i++)
{

#
#-----[ FIND ]------------------------------------------
#
$email_headers .= "Bcc: $bcc_list\n";

#
#-----[ REPLACE ]------------------------------------------
#
$email_headers .= "Bcc: $bcc_list[$i]\n";

#
#-----[ FIND ]------------------------------------------
#
$emailer->reset();

#
#-----[ AFTER, ADD ]------------------------------------------
#
}


#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/user_email_body.tpl

#
#-----[ FIND ]------------------------------------------
#
<h1>{L_EMAIL_TITLE}</h1>

#
#-----[ BEFORE, ADD ]------------------------------------------
#
<SCRIPT LANGUAGE="JavaScript">
<!--
function disableForm(theform) {
if (document.all || document.getElementById) {
for (i = 0; i < theform.length; i++) {
var tempobj = theform.elements;
if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset")
tempobj.disabled = true;
}
return true;
}
else {
alert("The form has been submitted. Please do NOT resubmit. ");
return false;
}
}
// End -->
</script>

#
#-----[ FIND ]------------------------------------------
#
<form method="post" action="{S_USER_ACTION}">

#
#-----[ REPLACE WITH ]------------------------------------------
#
<form method="post" action="{S_USER_ACTION}" onSubmit="return disableForm(this);">


#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
KimEdstrom
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 104
Blev medlem: 2006-03-14 17:51
Svar: 0
Kontakt:

Inlägg av KimEdstrom »

Kod: Markera allt

<?php
/***************************************************************************
*                             admin_mass_email.php
*                              -------------------
*     begin                : Thu May 31, 2001
*     copyright            : (C) 2001 The phpBB Group
*     email                : support@phpbb.com
*
*     $Id: admin_mass_email.php,v 1.15.2.7 2003/05/03 23:24:01 acydburn Exp $
*
****************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

define('IN_PHPBB', 1);

if( !empty($setmodules) )
{
	$filename = basename(__FILE__);
	$module['General']['Mass_Email'] = $filename;
	
	return;
}

//
// Load default header
//
$no_page_header = TRUE;
$phpbb_root_path = './../';
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);

//
// Increase maximum execution time in case of a lot of users, but don't complain about it if it isn't
// allowed.
//
@set_time_limit(1200);

$message = '';
$subject = '';

//
// Do the job ...
//
if ( isset($HTTP_POST_VARS['submit']) )
{
	$subject = stripslashes(trim($HTTP_POST_VARS['subject']));
	$message = stripslashes(trim($HTTP_POST_VARS['message']));
	
	$error = FALSE;
	$error_msg = '';

	if ( empty($subject) )
	{
		$error = true;
		$error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['Empty_subject'] : $lang['Empty_subject'];
	}

	if ( empty($message) )
	{
		$error = true;
		$error_msg .= ( !empty($error_msg) ) ? '<br />' . $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 = array();
		do
		{
			$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) ) ? '<br />' . $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']);
	
		$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 
	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 = '<select name = "' . POST_GROUPS_URL . '"><option value = "-1">' . $lang['All_users'] . '</option>';
if ( $row = $db->sql_fetchrow($result) )
{
	do
	{
		$select_list .= '<option value = "' . $row['group_id'] . '">' . $row['group_name'] . '</option>';
	}
	while ( $row = $db->sql_fetchrow($result) );
}
$select_list .= '</select>';

//
// 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);

?>
Skriv svar

Vilka är online

Användare som besöker denna kategori: 0 och 0 gäster