• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

AAC Znote Send email to all registered accounts

OverBash

Well-Known Member
Joined
Mar 18, 2019
Messages
138
Solutions
2
Reaction score
74
Location
Brasil
Does the site have an option to send email to all registered accounts?
with some update
I didn't find anything
 
Solution
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.


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`...
You can install the PHPMailer SMTP Client:

PHPMailer Version 6.x, extracted and renamed to just "PHPMailer" in Znote AAC directory.

Then figure out which SMTP server you want to use, I heard gmail works fine, but it limits you to like 25-50 emails per day (to get you started). I'm not sure which paid alternative is both cheap and easy to use.

Configurations in Znote AAC config.php file:
PHP:
$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'],
);
 
I tihnk he means to send an email to all registered accounts. Massive email with news or updates. Not an email when a new account is registered.
 
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.


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.
 
Solution
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.


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.

Thanks!! that was it!
 
Last edited by a moderator:
2020-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)
 
2020-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)
can anybody help me? I have that error and I could not solve it
 
Back
Top