Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: [MOD] Newsletter: Send email to every user  (Read 4818 times)

0 Members and 1 Guest are viewing this topic.

mushipkw

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 25
[MOD] Newsletter: Send email to every user
« on: September 13, 2009, 01:10:07 am »

I have written a newsletter mod to send an email with subject & message body to every user of your website.
The mod formats the message with:
Dear "user_name",

"message"

You just have to write the subject & message, it will automatically add the user name to the message.

Code: [Select]
<?php

define
('IN_COPPERMINE'1);
require 
'include/init.inc.php';

if (!
GALLERY_ADMIN_MODEcpg_die(ERROR$lang_errors['access_denied'], __FILE____LINE__);

@
set_time_limit(1200);

$message '';
$subject '';

if ( isset(
$_POST['submit']) )
{
        
$subject stripslashes(trim($HTTP_POST_VARS['subject']));
        
$message stripslashes(trim($HTTP_POST_VARS['message']));
        
$test cpg_db_query("SELECT user_name, user_email FROM {$CONFIG['TABLE_USERS']} WHERE user_email <> ''");

$headers 'From: '.$CONFIG['gallery_admin_email']."\r\n" .
'Reply-To: '.$CONFIG['gallery_admin_email']."\r\n" .
'X-Mailer: PHP/' phpversion();

while ($row mysql_fetch_assoc($test)) {
$fullmessage '';
$fullmessage 'Dear ' $row['user_name'] . ',' chr(13) . chr(13) . $message;
@mail($row['user_email'], $subject$fullmessage$headers);

}
}

pageheader($massmailer_php['title']);
starttable('100%''Newsletter Mod By Mushi');

echo <<<EOT
        <form method="post" action="$PHP_SELF">
        <tr>
            <td width="40%" class="tableb">
                        Subject
        </td>
        <td width="60%" class="tableb" valign="top">
                <input type="text" style="width: 100%" name="subject" class="textinput">
                </td>
        </tr>
        <tr>
                <td class="tableb" valign="top">
                        Message
                </td>
                <td class="tableb" valign="top">
                        <textarea name="message" ROWS="5" COLS="40" SIZE="9"  WRAP="virtual" STYLE="WIDTH: 100%;" class="textinput">
$resmsg</textarea>
                </td>
        </tr>
        <tr>
                <td colspan="2" align="center" class="tablef">
                <input type="submit" name="submit" value="Submit" class="button">
                </td>
                </form>
        </tr>

EOT;

endtable();
pagefooter();
ob_end_flush();
?>

Its very basic because I am just a beginner in PHP
Logged
Pages: [1]   Go Up
 

Page created in 0.024 seconds with 19 queries.