Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Mass Email [TTv3]
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Mods Completed

2019-04-14 21:46:05
Send a mass email to users. I pulled this from my old modded copy. Please test. I tested it and it worked, but we know how that goes lol
In admincp.php, add
#======================================================================#
#       Mass Mailer
#======================================================================#
if ($action == "massmail")
{
               if ($do == "send")
               {
                               $msg_log = "Sent to classes: ";
                               @set_time_limit(0);

                               $subject = $_POST["subject"];
                               $body = format_comment($_POST["body"]);

                               if (!$subject || !$body) show_error_msg("Error", "No subject or body specified.", 1);

                               if (!@count($_POST["groups"])) show_error_msg("Error", "No groups Selected.", 1);

                               $ids = array_map("intval", $_POST["groups"]);
                               $ids = implode(", ", $ids);

                               $res_log = SQL_Query_exec("SELECT DISTINCT level FROM groups WHERE group_id IN ($ids)");
                               while ($row_log = mysqli_fetch_assoc($res_log))
                               {    
                                       $msg_log .= $row_log["level"] . ", ";
                               }

                               $res = SQL_Query_exec("SELECT u.email FROM users u LEFT JOIN groups g ON u.class = g.group_id WHERE u.enabled = 'yes' AND u.status = 'confirmed' AND u.class IN ($ids)");
                               while ($row = mysqli_fetch_assoc($res))
                               {    
                                       sendmail($row["email"], $subject, $body, "Content-type: text/html; charset=utf-8", "-f$site_config[SITEEMAIL]");
                               }

                              write_log("<b><font color='Magenta'>A Mass E-Mail</font> was sent by (<font color='Navy'>$CURUSER[username]</font>) $msg_log<b>");
//                               show_error_msg("Success", "Your Mass E-mail was sent.", 1);
                               autolink ("admincp.php", "<b><font color='#ff0000'>Mass mail sent....</font></b>");
               }

               $res = SQL_Query_exec("SELECT `group_id`, `level` FROM `groups` ORDER BY `group_id` ASC");

               stdhead("Mass Mailer");
               navmenu();
               begin_frame("Mass Mailer");
               ?>

               <center>
               This page allows you to send a mass-email to all members, in the usergroups you choose.
               </center>

               <br />
               <form id="massmail" name="massmail" method="post" action="admincp.php?action=massmail">
               <input type="hidden" name="do" value="send" />
               <table border="0" cellpadding="3" cellspacing="0" width="100%" align="center">
               <tr>
                               <td align="center">Subject: <input type="text" name="subject" size="40" /></td>
               </tr>
               <tr>
                               <td align="center">To:
                               <?php while ($row = mysqli_fetch_assoc($res)): ?>
                               <input type="checkbox" name="groups[]" value="<?php echo $row["group_id"]; ?>" /> <?php echo $row["level"]; ?>
                               <?php endwhile; ?>
                               <input type="checkbox" name="checkall" onclick="checkAll(this.form.id)" /> All
                               </td>
               </tr>
               <tr>
                               <td align="center"><?php echo textbbcode("massmail", "body"); ?></td>
               </tr>
               <tr>
                               <td colspan="2" align="center">
                               <input type="submit" value="Send" />
                               <input type="reset" value="Reset" />
                               </td>
               </tr>
               </table>                          
               </form>

               <?php
           
               end_frame();
               stdfoot();
}
#======================================================================#
#       End Mass Mail
#======================================================================#


create a new ACP link for this mod in admincp.php. Near the top of the file is where all the links are located. You will have to see how its displayed and adjust accordingly
     <td align="center"><a href="admincp.php?action=massmail"><img src="images/admin/massmail.png" border="0" width="118" height="80" alt="" /><br /><?php echo T_("MASSMAILER"); ?><br /></a></td>


add to languages/english.php
$LANG["MASSMAILER"] = "Mass Mailer";


upload image to images/admin folder, or create your own image, naming it massmail.png
[ATTACH alt="2634"]5022._xfImport[/ATTACH]
[ATTACH type="full" alt="2635"]5023._xfImport[/ATTACH]

If you like, you can use gmail to send your mails by editing the backend/config.php file like so. Keep in mind that users will receive an email with that gmail address, so create a new one just for this purpose
$site_config["mail_type"] = "pear";  /// Must have pear installed and working
$site_config["mail_smtp_host"] = "smtp.gmail.com"; // SMTP server hostname
$site_config["mail_smtp_port"] = "465"; // SMTP server port
$site_config["mail_smtp_ssl"] = true; // true to use SSL
$site_config["mail_smtp_auth"] = true; // true to use auth for SMTP
$site_config["mail_smtp_user"] = "user@gmail.com"; // SMTP username
$site_config["mail_smtp_pass"] = "gmail_password"; // SMTP password
massmail.png
massmail.png
Capture.PNG
Capture.PNG

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2019-05-09 00:35:03
work and fix
email system
2019-05-12 05:11:51
not sure what you are saying...
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Unknown User
2019-05-13 18:23:25
A small info about this.

gmail and those free smtps limits 500 emails per day. Also this feature can leak your server IP in mail headers and that could trace down your hosting provider.

If you are not good with hiding those, it's better to use mass pm option.
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 9
  • Members: 0
  • Guests online: 9
  • Comments: 3
  • Messages: 1,728