Author Topic: [PLUGIN] Massmailer/Batch Mailer  (Read 58230 times)

0 Members and 1 Guest are viewing this topic.

Offline Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
[PLUGIN] Massmailer/Batch Mailer
« on: January 03, 2008, 10:30:42 PM »
Save it as email.php, massmailer.php or what ever and put it into your /admin/plugins/ folder...

Code: [Select]
<?php // PLUGIN_TITLE: Massmailer
/**************************************************************************
*                                                                        *
*    4images - A Web Based Image Gallery Management System               *
*    ----------------------------------------------------------------    *
*                                                                        *
*             File: email.php                                            *
*        Copyright: (C) 2002 Jan Sorgalla                                *
*            Email: jan@4homepages.de                                    *
*              Web: http://www.4homepages.de                             *
*    Scriptversion: 1.7.1                                                *
*                                                                        *
*    Never released without support from: Nicky (http://www.nicky.net)   *
*                                                                        *
**************************************************************************
*                                                                        *
*    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
*    bedingungen (Lizenz.txt) für weitere Informationen.                 *
*    ---------------------------------------------------------------     *
*    This script is NOT freeware! Please read the Copyright Notice       *
*    (Licence.txt) for further information.                              *
*                                                                        *
*************************************************************************/

$nozip 1;
define('IN_CP'1);

$PHP_SELF = (isset($PHP_SELF)) ? $PHP_SELF $_SERVER['PHP_SELF'];
$root_path = (eregi("\/plugins\/"$PHP_SELF)) ? "./../../" "./../";
define('ROOT_PATH'$root_path);
require(
ROOT_PATH.'admin/admin_global.php');

// TEXT
define('MASSMAIL_TITEL'"Emails an User versenden");
define('MASSMAIL_MAXMAILS'"Anzahl der Mails die verschickt werden sollen");
define('MASSMAIL_BREAK'"Pause (sec.)");
define('MASSMAIL_AUTOREDIRECT'"Automatische Weiterleitung");
define('MASSMAIL_USERLEVEL'"Userlevel");
define('MASSMAIL_SUBJECT'"Betreff");
define('MASSMAIL_MESSAGE'"Nachricht");
define('MASSMAIL_BUTTON_SEND'"E-Mails an User versenden");
define('MASSMAIL_SUBJECT2'"Betreff (%=wildcard)");
define('MASSMAIL_MESSAGE2'"Nachricht (%=wildcard)");
define('MASSMAIL_LIMITFROM'"Starte bei:");
define('MASSMAIL_SENDTO'"<b>Mail an folgende User: </b>");
define('MASSMAIL_DONE'"<b>Alle Mails dieser Usergruppe wurden erfolgreich versendet... </b>");

// CONFIG
$config_break 3;
$config_maxemails 2;
$config_default_subject "Betreff...";
$config_default_message "Nachricht...";

if (
$action == "") {
    
$action "emailusers";
}

show_admin_header();

if (
$action == "sendemails") {
    
$error = array();
    
$maxemails stripslashes(trim($_REQUEST['maxemails']));
    
$break stripslashes(trim($_REQUEST['break']));
    
$autoredirect stripslashes(trim($_REQUEST['autoredirect']));
    
$user_level $_REQUEST['user_level'];
    
$subject stripslashes(trim($_REQUEST['subject']));
    
$message stripslashes(trim($_REQUEST['message']));

    if (
$maxemails == "") {
        
$error['maxemails'] = 1;
    }
    if (
$break == "") {
        
$error['break'] = 1;
    }
    if (
$user_level <= || $user_level == "") {
        
$error['user_level'] = 1;
    }
    if (
$subject == "") {
        
$error['subject'] = 1;
    }
    if (
$message == "") {
        
$error['message'] = 1;
    }
    if (empty(
$error)) {

        
// SQL Limit
        
if (isset($_REQUEST['limitfrom'])) {
            
$limitfrom $_REQUEST['limitfrom'];
            
$limitfrom $limitfrom $maxemails;
        }else{
            
$limitfrom 0;
        }
        if (isset(
$_REQUEST['i'])) {
            
$i $_REQUEST['i'];
        }else {
            
$i 0;
        }
        
define("PM_LIMIT""DESC LIMIT ".$limitfrom." , ".$maxemails);
        
// SQL Limit Ende

        //Where definieren
        
define('WHERE_ID'"WHERE user_level = '".$user_level."'");

        
// Mailaddi aus der Datenbank holen
        
global $site_db;
        
$sql "SELECT user_email, user_name
FROM "
.USERS_TABLE."
"
.WHERE_ID." AND ".get_user_table_field("""user_allowemails")." = 1
ORDER BY user_id
"
.PM_LIMIT;
        
$result $site_db->query($sql);
        
$num_of_rows mysql_num_rows($result);
        
//SQL Debug
        //echo $sql."<br>";

        //Empfänger
        
$emails = array();
        echo 
MASSMAIL_SENDTO."<br>";
        while(
$row $site_db->fetch_array($result)){
            
// Username (E-Mail) ausgeben
            
echo " ".$i++." - ".$row["user_name"]." (".$row["user_email"].")<br>";
            
array_push($emails$row["user_email"]);
        }
        
//Empfänger Ende

        //E-Mail
        
include(ROOT_PATH.'includes/email.php');
        
$site_email = new Email();
        
$site_email->set_to($config['site_email']);
        
$site_email->set_subject($subject);
        
$site_email->register_vars(array(
        
"message" => $message,
        
"site_email" => $config['site_email'],
        
"site_name" => $config['site_name']
        ));
        
$site_email->set_body("admin_email"$config['language_dir']);
        
$site_email->set_bcc($emails);
        echo (
$site_email->send_email()) ? $lang['send_emails_success'] : $lang['send_emails_error'];
        unset(
$site_email);
        
//E-Mail Ende

        //Alle Mails versendet
        
if ($num_of_rows $maxemails) {
            
$autoredirectfalse;
            echo 
"<br><br>".MASSMAIL_DONE."<br><br>";
        }

        
//Formular ausgeben
        
show_form_header("email.php""sendemails");
        
show_table_header(MASSMAIL_TITEL2);
        
show_input_row(MASSMAIL_LIMITFROM"limitfrom"$limitfrom3);
        
show_input_row(MASSMAIL_MAXMAILS"maxemails"$maxemails5);
        
show_input_row(MASSMAIL_BREAK"break"$break5);
        
show_radio_row(MASSMAIL_AUTOREDIRECT"autoredirect"1);
        
show_userlevel_select_row(MASSMAIL_USERLEVEL"user_level"$user_level);
        
show_input_row(MASSMAIL_SUBJECT"subject"$subject45);
        
show_textarea_row(MASSMAIL_MESSAGE"message"$message6020);
        
show_form_footer(MASSMAIL_BUTTON_SEND""2);


        if (
$autoredirect) {
            
$page $site_sess->url($_SERVER['PHP_SELF']."?action=sendemails&limitfrom=".$limitfrom."&maxemails=".$maxemails."&break=".$break."&user_level=".$user_level."&i=".$i."&autoredirect=".$autoredirect."&subject=".$subject."&message=".$message);
?>

<script language="javascript">
myvar = "";
timeout = <?php echo $break ?>;
function dorefresh() {
    window.status="Redirecting"+myvar;
    myvar = myvar + " .";
    timerID = setTimeout("dorefresh();", 1000);
    if (timeout > 0) {
        timeout -= 1;
    }
    else {
        clearTimeout(timerID);
        //document.formular.submit()
        window.status="";
        window.location="<?php echo $page?>";
    }
}
dorefresh();
</script>
<?php

        
}
    }else {
        
$msg sprintf("<span class=\"marktext\">%s</span>"$lang['lostfield_error']);
        
$action "emailusers";

    }

}

if (
$action == "emailusers") {
    if (
$msg != "") {
        
printf("<b>%s</b>\n"$msg);
    }
    
show_form_header("email.php""sendemails");
    
show_table_header(MASSMAIL_TITEL2);
    
show_input_row(MASSMAIL_MAXMAILS"maxemails"$config_maxemails5);
    
show_input_row(MASSMAIL_BREAK"break"$config_break5);
    
show_radio_row(MASSMAIL_AUTOREDIRECT"autoredirect"1);
    
show_userlevel_select_row(MASSMAIL_USERLEVEL"user_level"$user_row['user_level']);
    
show_input_row(MASSMAIL_SUBJECT"subject"$config_default_subject45);
    
show_textarea_row(MASSMAIL_MESSAGE"message"$config_default_message6020);
    
show_form_footer(MASSMAIL_BUTTON_SEND""2);
}

show_admin_footer();
?>

Please try it and give me Feedback...
I have not enough Users in on my Test System... (o:
« Last Edit: January 03, 2008, 11:30:34 PM by Acidgod »

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [PLUGIN] Massmailer/Batch Mailer
« Reply #1 on: January 03, 2008, 10:33:26 PM »
1 - I say for fix code before publish ...
2 - User is warn for set block from cPanel (SPAM email) filter ... check setting for see if enable ... if enable - is no work ...
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline nobby

  • 4images Guru
  • *******
  • Posts: 2.873
    • View Profile
Re: [PLUGIN] Massmailer/Batch Mailer
« Reply #2 on: January 03, 2008, 10:39:13 PM »
Hallo Acidgod,

das ist gut. Werde es bei Gelegenheit mal testen.

nobby

Offline Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: [PLUGIN] Massmailer/Batch Mailer
« Reply #3 on: January 03, 2008, 10:45:57 PM »
 @ thunderstrike
8O
Sorry but i don't now what you mean... ^^

Kann das wer für den dummen Acid übersetzen?

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [PLUGIN] Massmailer/Batch Mailer
« Reply #4 on: January 03, 2008, 10:49:13 PM »
Quote
Sorry but i don't now what you mean... ^^

For no. 1 - hint: $_REQUEST is no use in 4images. ;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline nobby

  • 4images Guru
  • *******
  • Posts: 2.873
    • View Profile
Re: [PLUGIN] Massmailer/Batch Mailer
« Reply #5 on: January 03, 2008, 10:50:51 PM »
Quote
Sorry but i don't now what you mean... ^^

For no. 1 - hint: $_REQUEST is no use in 4images. ;)

Deutsch: Für Nr. 1 - Hinweis: $ _REQUEST ist kein Einsatz in 4images.

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [PLUGIN] Massmailer/Batch Mailer
« Reply #6 on: January 03, 2008, 11:55:00 PM »
unnötige posts gelöscht.
peace!
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [PLUGIN] Massmailer/Batch Mailer
« Reply #7 on: January 04, 2008, 12:03:53 AM »
@Acidgod
... eine Userauswahl / - einschränkung kann leider nur über den Userlevel erfolgen ...
... eine Userauswahl anhand von Usergruppen wäre für mich sehr hilfreich (eventuell für andere auch) ...
... kannst du das noch integrieren ... wäre toll ... !
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: [PLUGIN] Massmailer/Batch Mailer
« Reply #8 on: January 04, 2008, 12:15:47 AM »
Hier werden nur die Usergruppen benutzt...
Eine Auswahl einzelner User ist hier nicht möglich... ^^

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [PLUGIN] Massmailer/Batch Mailer
« Reply #9 on: January 04, 2008, 01:06:03 AM »
... also eine Auswahl der Usergruppen ist bei mir nicht möglich ...
... es sei denn, du bezeichnest "Administartoren, Registrierte User, Nicht aktivierte registrierte User" als Usergruppen ...
... doch das sind die 4images Userlevel ...
... ich meine jedoch die "richtigen" Usergruppen, die man individuell im ACP->User verwalten definieren kann ...
... und den Mitgliedern solcher Usergruppen möchte ich die e-mails getrennt verschicken ...
... es müsste also noch ein Dropdownmenü her, in dem die Auswahl der Usergruppen (sofern vorhanden) erfolgen kann ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: [PLUGIN] Massmailer/Batch Mailer
« Reply #10 on: January 04, 2008, 11:19:24 AM »
War gester doch schon soooo spät... *g*

Ich werde später mal schauen ob ich das für dich erweitern/anpassen kann... (o:

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [PLUGIN] Massmailer/Batch Mailer
« Reply #11 on: January 04, 2008, 11:43:40 AM »
... zumindest schon mal meine Problemstellung erkannt ... ;)
... Danke ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: [PLUGIN] Massmailer/Batch Mailer
« Reply #12 on: January 04, 2008, 03:20:37 PM »
Werde das schon hinbekommen... *g*
Nur bin ich mir bisher nicht mal sicher das dieses Plugin einwandfrei funzt... *g*

Daher sollten wir vielleicht mal abwarten bis es wer getestet hat... (o:

Offline m.a

  • Jr. Member
  • **
  • Posts: 83
    • View Profile
Re: [PLUGIN] Massmailer/Batch Mailer
« Reply #13 on: June 11, 2008, 02:46:06 AM »
Hallo Acidgod,
ich habe es probiert!
Beim E-Mails an User versenden, wird es nicht funktionieren!
Es wird (Die Seite wurde nicht gefunden) angezeigt.

Daher sollten wir vielleicht mal abwarten bis es wer getestet hat... (o:

Grüß
m.a

Offline k1lljoy

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
    • Razruha.Ru
Re: [PLUGIN] Massmailer/Batch Mailer
« Reply #14 on: June 21, 2008, 04:58:54 PM »
Is there english version of this plugin?  :oops: