<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
protect_page();
admin_only($user_data);
$email_list = array();
$development_mode = (!isset($_GET['RUN'])) ? true : false;
$development_SQL = ($development_mode) ? "AND `a`.`id`='{$session_user_id}'" : '';
// Load all accounts
$accounts = mysql_select_multi("
SELECT
`a`.`name`...
yea, in config.phpDoes the site have an option to send email to all registered accounts?
with some update
I didn't find anything
'register' => false, // Send activation mail
$config['mailserver'] = array(
'register' => false, // Send activation mail
'accountRecovery' => false, // Recover username or password through mail
'host' => "mailserver.znote.eu", // Outgoing mail server host.
'securityType' => 'ssl', // ssl or tls
'port' => 465, // SMTP port number - likely to be 465(ssl) or 587(tls)
'email' => '[email protected]',
'username' => '[email protected]', // Likely the same as email
'password' => 'emailpassword', // The password.
'debug' => false, // Enable debugging if you have problems and are looking for errors.
'fromName' => $config['site_title'],
);
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
protect_page();
admin_only($user_data);
$email_list = array();
$development_mode = (!isset($_GET['RUN'])) ? true : false;
$development_SQL = ($development_mode) ? "AND `a`.`id`='{$session_user_id}'" : '';
// Load all accounts
$accounts = mysql_select_multi("
SELECT
`a`.`name`,
`a`.`email`
FROM `accounts` AS `a`
INNER JOIN `znote_accounts` AS `za`
ON `a`.`id` = `za`.`account_id`
WHERE `za`.`active` = 1
AND `a`.`email` LIKE '%@%'
{$development_SQL}
");
// Create variables to use in email body text
$OT_name = $config['site_title'];
$website_URL = $config['site_url'];
$shop_URL = $config['site_url'] . "/shop.php";
// Intiialize PHP email client
$mailer = new Mail($config['mailserver']);
// Email title
$title = "{$OT_name}: Christmas Update, double xp weekend and shop sale!";
// Loop through all accounts
foreach ($accounts as $account):
$username = $account['name'];
$email = $account['email'];
$email_list[] = $email;
// Email body
$body = "<h1>Christmas Update</h1>
<p>A new christmas update with lots of cool new stuff implemented!</p>
<p>To celebrate the christmas update, we are also activating a double xp weekend!</p>
<p>Head on over to <a href='{$website_URL}'>{$website_URL}</a> for more information.</p>
<h2>Special christmas sale!</h2>
<p>We are currently having a christmas sale, with a 20% discount on all shop items!</p>
<hr><p>I am an automatic no-reply e-mail. Any emails sent back to me will be ignored.</p>
";
// Send email
$mailer->sendMail($email, $title, $body, $username);
endforeach;
?>
<p><strong>Development mode: </strong><?php echo ($development_mode) ? 'Yes. Only sending email to admin account.' : 'No. Trying to send to everyone.'; ?></p>
<?php if ($development_mode): ?>
<p>If email looks good and you are ready to send mass mail, click <a href="?RUN=true">RUN MASS EMAIL</a>.</p>
<?php endif;
data_dump($email_list, false, "Emails sent to these addresses:");
include 'layout/overall/footer.php'; ?>
$body =
and $title with email title and text. Body should support basic HTML tags. Hmm, can be created. But be warned, unless your paying for an SMTP service, but use a free service like gmail or hotmail, you will most likely be banned/blocked after the first 25-50 mails.
Send an email to all registered accounts on Znote AAC.
Send an email to all registered accounts on Znote AAC. - admin_mass_email.phpgist.github.com
Installation:
PHPMailer must already be set up and working.
Create admin_mass_email.php
With this content:
PHP:<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; protect_page(); admin_only($user_data); $email_list = array(); $development_mode = (!isset($_GET['RUN'])) ? true : false; $development_SQL = ($development_mode) ? "AND `a`.`id`='{$session_user_id}'" : ''; // Load all accounts $accounts = mysql_select_multi(" SELECT `a`.`name`, `a`.`email` FROM `accounts` AS `a` INNER JOIN `znote_accounts` AS `za` ON `a`.`id` = `za`.`account_id` WHERE `za`.`active` = 1 AND `a`.`email` LIKE '%@%' {$development_SQL} "); // Create variables to use in email body text $OT_name = $config['site_title']; $website_URL = $config['site_url']; $shop_URL = $config['site_url'] . "/shop.php"; // Intiialize PHP email client $mailer = new Mail($config['mailserver']); // Email title $title = "{$OT_name}: Christmas Update, double xp weekend and shop sale!"; // Loop through all accounts foreach ($accounts as $account): $username = $account['name']; $email = $account['email']; $email_list[] = $email; // Email body $body = "<h1>Christmas Update</h1> <p>A new christmas update with lots of cool new stuff implemented!</p> <p>To celebrate the christmas update, we are also activating a double xp weekend!</p> <p>Head on over to <a href='{$website_URL}'>{$website_URL}</a> for more information.</p> <h2>Special christmas sale!</h2> <p>We are currently having a christmas sale, with a 20% discount on all shop items!</p> <hr><p>I am an automatic no-reply e-mail. Any emails sent back to me will be ignored.</p> "; // Send email $mailer->sendMail($email, $title, $body, $username); endforeach; ?> <p><strong>Development mode: </strong><?php echo ($development_mode) ? 'Yes. Only sending email to admin account.' : 'No. Trying to send to everyone.'; ?></p> <?php if ($development_mode): ?> <p>If email looks good and you are ready to send mass mail, click <a href="?RUN=true">RUN MASS EMAIL</a>.</p> <?php endif; data_dump($email_list, false, "Emails sent to these addresses:"); include 'layout/overall/footer.php'; ?>
Enter yourwebite.com/admin_mass_email.php after you have logged into Znote AAC with admin access.
See if you get test mail.
Edit admin_mass_email.php$body =
and $title with email title and text. Body should support basic HTML tags.
When your ready to send mass mails, click the link RUN MASS EMAIL.
can anybody help me? I have that error and I could not solve it2020-07-18 00:31:31 SERVER -> CLIENT: 220 BL0PR0102CA0024.outlook.office365.com Microsoft ESMTP MAIL Service ready at Sat, 18 Jul 2020 00:31:29 +0000
2020-07-18 00:31:31 CLIENT -> SERVER: EHLO otlatino.com
2020-07-18 00:31:31 SERVER -> CLIENT: 250-BL0PR0102CA0024.outlook.office365.com Hello [192.99.168.129]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-STARTTLS250-8BITMIME250-BINARYMIME250-CHUNKING250 SMTPUTF8
2020-07-18 00:31:31 CLIENT -> SERVER: STARTTLS
2020-07-18 00:31:31 SERVER -> CLIENT: 220 2.0.0 SMTP server ready
2020-07-18 00:31:31 CLIENT -> SERVER: EHLO otlatino.com
2020-07-18 00:31:31 SERVER -> CLIENT: 250-BL0PR0102CA0024.outlook.office365.com Hello [192.99.168.129]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-AUTH LOGIN XOAUTH2250-8BITMIME250-BINARYMIME250-CHUNKING250 SMTPUTF8
2020-07-18 00:31:31 CLIENT -> SERVER: AUTH LOGIN
2020-07-18 00:31:31 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2020-07-18 00:31:31 CLIENT -> SERVER: [credentials hidden]
2020-07-18 00:31:31 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2020-07-18 00:31:31 CLIENT -> SERVER: [credentials hidden]
2020-07-18 00:31:36 SERVER -> CLIENT: 535 5.7.3 Authentication unsuccessful [BL0PR0102CA0024.prod.exchangelabs.com]
2020-07-18 00:31:36 SMTP ERROR: Password command failed: 535 5.7.3 Authentication unsuccessful [BL0PR0102CA0024.prod.exchangelabs.com]
SMTP Error: Could not authenticate.
2020-07-18 00:31:36 CLIENT -> SERVER: QUIT
2020-07-18 00:31:36 SERVER -> CLIENT: 221 2.0.0 Service closing transmission channel
SMTP connect() failed. PHPMailer/PHPMailer (https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting)
Mailer Error: SMTP connect() failed. PHPMailer/PHPMailer (https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting)