• 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!

[Gesior AAC] Mass emails sender

Norix

Hosting Service !
Joined
Jan 18, 2008
Messages
544
Reaction score
8
Location
Germany
Hi,
I've made a script which sends a email to every email that is saved in the database. I dont know if it works good with much emails, i've only tested it with 3 different accounts and it worked. Just make a new file called mail.php and add it in index.php.

Script:
PHP:
<?PHP
if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) {
$email = $SQL->query('SELECT * FROM '.$SQL->tableName('accounts').' WHERE email != "";');
$mail_content = stripslashes(trim($_POST['mail_content']));
$subject = stripslashes(ucwords(strtolower(trim($_REQUEST['subject']))));
if(empty($mail_content)) {
$main_content .= '<form action="" method="post"><b>Subject Title:</b><input type="textbox" name="subject"><br>
<b>Mail Content:</b><textarea name="mail_content" rows="3" cols="45"></textarea><br><input type="submit" value="Send emails">
</form>';
} else {
require("phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
foreach($email  as $emails) {
if ($config['site']['smtp_enabled'] == "yes") {
$mail->IsSMTP();
$mail->Host = $config['site']['smtp_host'];
$mail->Port = (int)$config['site']['smtp_port'];
$mail->SMTPAuth = ($config['site']['smtp_auth'] ? true : false);
$mail->Username = $config['site']['smtp_user'];
$mail->Password = $config['site']['smtp_pass'];
} else
$mail->IsMail();
$mail->IsHTML(true);
$mail->From = $config['site']['mail_address'];
$mail->AddAddress($emails['email']);
$mail->Subject = $subject;
$mail->Body = $mail_content;
}
if($mail->Send())
{
$main_content .= '<br />Mass emails has been sent.';
} else {
$main_content .= '<br />An error occorred while sending email! Try again or contact with admin.';
}
}
}
else
$main_content .= 'Sorry, you have not the rights to access this page.';
?>

Please report any bugs you find.
Please rep ++ !!

Your's Norix
 
Not worked to me, I have some 10k of accounts. I believe it would be necessary to create a delay between each transmission of message and shows how many emails are being sent and how many had already been sent.

Anyway, good idea to code.

=p
 
You have configured your email options in config.php right?
 
Cool, Works fine for me! tested it and it works fine!
 
Best if you register on GMX - E-Mail, FreeMail, Themen- & Shopping-Portal and then take this as config.

Code:
// E-MAIL config
$config['site']['send_emails'] = 1; // is acc. maker configured to send e-mails?
$config['site']['mail_address'] = "[email protected]"; // e-mail address
$config['site']['smtp_enabled'] = "yes"; // send by smtp or mail function (set 0 if use mail function)
$config['site']['smtp_host'] = "mail.gmx.com"; // address
$config['site']['smtp_port'] = 25; // port
$config['site']['smtp_auth'] = "yes"; // need authorization? (set 0 if not need auth)
$config['site']['smtp_user'] = "[email protected]"; // login
$config['site']['smtp_pass'] = "yourpassword"; // password
 
An error occorred while sending email! Try again or contact with admin.

On both servers, but config.php is configured well, it sends e-mail when somebody recovers accounts to buy new rec. It would be awesome if you made it work.
__________________
klekSu.png

You are welcome on kleksoria.com!
Please visit new open tibia forum with it's own ots list. otservers.net!
 
Last edited:
Hi,
I've made a script which sends a email to every email that is saved in the database. I dont know if it works good with much emails, i've only tested it with 3 different accounts and it worked. Just make a new file called mail.php and add it in index.php.

Script:
PHP:
<?PHP
if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) {
$email = $SQL->query('SELECT * FROM '.$SQL->tableName('accounts').' WHERE email != "";');
$mail_content = stripslashes(trim($_POST['mail_content']));
$subject = stripslashes(ucwords(strtolower(trim($_REQUEST['subject']))));
if(empty($mail_content)) {
$main_content .= '<form action="" method="post"><b>Subject Title:</b><input type="textbox" name="subject"><br>
<b>Mail Content:</b><textarea name="mail_content" rows="3" cols="45"></textarea><br><input type="submit" value="Send emails">
</form>';
} else {
require("phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
foreach($email  as $emails) {
if ($config['site']['smtp_enabled'] == "yes") {
$mail->IsSMTP();
$mail->Host = $config['site']['smtp_host'];
$mail->Port = (int)$config['site']['smtp_port'];
$mail->SMTPAuth = ($config['site']['smtp_auth'] ? true : false);
$mail->Username = $config['site']['smtp_user'];
$mail->Password = $config['site']['smtp_pass'];
} else
$mail->IsMail();
$mail->IsHTML(true);
$mail->From = $config['site']['mail_address'];
$mail->AddAddress($emails['email']);
$mail->Subject = $subject;
$mail->Body = $mail_content;
}
if($mail->Send())
{
$main_content .= '<br />Mass emails has been sent.';
} else {
$main_content .= '<br />An error occorred while sending email! Try again or contact with admin.';
}
}
}
else
$main_content .= 'Sorry, you have not the rights to access this page.';
?>

Please report any bugs you find.
Please rep ++ !!

Your's Norix

I prefer to add host, port connection before foreach (or class destroying after send?). You have AddAdresses function too. Look at Addresses. Its better for multi.
 
Best if you register on GMX - E-Mail, FreeMail, Themen- & Shopping-Portal and then take this as config.

Code:
// E-MAIL config
$config['site']['send_emails'] = 1; // is acc. maker configured to send e-mails?
$config['site']['mail_address'] = "[email protected]"; // e-mail address
$config['site']['smtp_enabled'] = "yes"; // send by smtp or mail function (set 0 if use mail function)
$config['site']['smtp_host'] = "mail.gmx.com"; // address
$config['site']['smtp_port'] = 25; // port
$config['site']['smtp_auth'] = "yes"; // need authorization? (set 0 if not need auth)
$config['site']['smtp_user'] = "[email protected]"; // login
$config['site']['smtp_pass'] = "yourpassword"; // password

Im not deutch :( Know any english smtp host?
 
Fatal error: Call to a member function query() on a non-object in C:\xampp\htdocs\mail.php on line 3
 
The problems why the script cant send with much accounts is propably because many people write wrong emails there so the script takes too much time and then it doesn work correctly :S have to check how to make it work...

EDIT: If you wanna have it work you have to be sure every account has a valid email. Propably the only way to be sure is if you configure AAC that it sends new password to the email adress on account creation...
 
Last edited:
Maybe anyone know how to configure acc to work with gmail? I dont really understand errors in this de site :/
 
No errors, just cannot load page.
Tried with gmail, I don't know German good enough to make account on gmx, I tried but I get some errors and nothing more
 
The problems why the script cant send with much accounts is propably because many people write wrong emails there so the script takes too much time and then it doesn work correctly :S have to check how to make it work...

EDIT: If you wanna have it work you have to be sure every account has a valid email. Propably the only way to be sure is if you configure AAC that it sends new password to the email adress on account creation...

Is that needed? Yea i wrote long e-mail... also how can i be sure the e-mails are correct when i got over 40k accounts, i'm sure 75% of them aren't. Still it shows the same error =/
__________________
klekSu.png

You are welcome on kleksoria.com!
Please visit new open tibia forum with it's own ots list. otservers.net!
 
Last edited:
Back
Top