Email Blasting

Hi, we are planning to email every month all of the registered in the site.
The content must include

- Rank Position in Specific Category
- Rank Position in Global

How to do this automatically? when sending emails?
 

Basti

Administrator
Staff member
At the moment this is not possible, the email ajax would need to have
- tag replacements. Should not be to hard though. so you can enter any template tag as in any html file
- plugin hooks so you can extend stuff ( rank stuff are calculated on the ranking, so you need custom stuff ) and enter custom tags into the message

The automatic sending though is straight up not possible with this system and it would need to be manual each month. Alternatively when plugin are in place you can create a plugin with a cron while which kind of duplicates our ajax.php send_email function
 
It is ok to send it manually by month, what is important are the content to have
- Rank Position in Specific Category
- Rank Position in Global
 

cajkan

Active Member
You might do this, but email got spam filters and most likely your emails gonna end up in JUNK/SPAM folders so you must be careful with thouse emails
 

Basti

Administrator
Staff member
Ok I finished this feature for visiolist 1.7
Unzip the attached file and upload the contents to your toplist root.

1) Now by default you can use in subject and email body any tag as your used to from templates. That means any database column from VL_sites or VL_stats table.
e.g
Hello {$username},
you have {$unq_in_0_monthly} votes this month
2) The email queue list is no longer a list of emails, but usernames
3) Now supports plugins


The following I have not tested, so make sure to only include a test user in your queue list
To get your rank positions in place, you would need to add plugin files. You already have a plugin for this if I remember, so add the files in there
1) ajax_send_mail_start.php
- You might need to adjust your order by here at start of the file, to match your alexa stuff. I just copied this from other thread
Code:
// Make ORDER BY clause
$order_by = base::rank_by($CONF['ranking_method'])." DESC, unq_{$CONF['ranking_method']}_overall DESC";

$user_data['rank_overall'] = 1;
$rank_result = $DB->query("SELECT sites.username FROM {$CONF['sql_prefix']}_sites sites, {$CONF['sql_prefix']}_stats stats WHERE sites.username = stats.username AND active = 1 ORDER BY {$order_by}", __FILE__, __LINE__);
while (list($username) = $DB->fetch_array($rank_result))
{
    if($username == $user_data['username'])
    {
      break;
    }
    $user_data['rank_overall']++;
}

// Escape users category
$category_rank_sql = $DB->escape($category_raw, 1);

$user_data['rank_category'] = 1;
$rank_result = $DB->query("SELECT sites.username FROM {$CONF['sql_prefix']}_sites sites, {$CONF['sql_prefix']}_stats stats WHERE sites.username = stats.username AND active = 1 AND category = '{$category_rank_sql}' ORDER BY {$order_by}", __FILE__, __LINE__);
while (list($username) = $DB->fetch_array($rank_result))
{
    if($username == $user_data['username'])
    {
      break;
    }
    $user_data['rank_category']++;
}
Now you should be able to use {$rank_overall} and {$rank_category} in email message

EDIT:: Zip removed since it comes into Visiolist 1.7
 
Last edited:
Ok I finished this feature for visiolist 1.7
Unzip the attached file and upload the contents to your toplist root.

1) Now by default you can use in subject and email body any tag as your used to from templates. That means any database column from VL_sites or VL_stats table.
e.g


2) The email queue list is no longer a list of emails, but usernames
3) Now supports plugins


The following I have not tested, so make sure to only include a test user in your queue list
To get your rank positions in place, you would need to add plugin files. You already have a plugin for this if I remember, so add the files in there
1) ajax_send_mail_start.php
- You might need to adjust your order by here at start of the file, to match your alexa stuff. I just copied this from other thread
Code:
// Make ORDER BY clause
$order_by = base::rank_by($CONF['ranking_method'])." DESC, unq_{$CONF['ranking_method']}_overall DESC";

$user_data['rank_overall'] = 1;
$rank_result = $DB->query("SELECT sites.username FROM {$CONF['sql_prefix']}_sites sites, {$CONF['sql_prefix']}_stats stats WHERE sites.username = stats.username AND active = 1 ORDER BY {$order_by}", __FILE__, __LINE__);
while (list($username) = $DB->fetch_array($rank_result))
{
    if($username == $user_data['username'])
    {
      break;
    }
    $user_data['rank_overall']++;
}

// Escape users category
$category_rank_sql = $DB->escape($category_raw, 1);

$user_data['rank_category'] = 1;
$rank_result = $DB->query("SELECT sites.username FROM {$CONF['sql_prefix']}_sites sites, {$CONF['sql_prefix']}_stats stats WHERE sites.username = stats.username AND active = 1 AND category = '{$category_rank_sql}' ORDER BY {$order_by}", __FILE__, __LINE__);
while (list($username) = $DB->fetch_array($rank_result))
{
    if($username == $user_data['username'])
    {
      break;
    }
    $user_data['rank_category']++;
}
Now you should be able to use {$rank_overall} and {$rank_category} in email message

Im lost with this , where should i put this code? ajax_send_mail_start.php?
how to start and where to put the email content?
 

Basti

Administrator
Staff member
Im lost with this , where should i put this code? ajax_send_mail_start.php?
Like i said, you already have plugin for the rank overall/category stuff right? make the file there and put that content in that file

how to start and where to put the email content?
Not sure what you mean here? Go to admin - > email members and write your email with the tags include
Now you should be able to use {$rank_overall} and {$rank_category} in email message
 

Basti

Administrator
Staff member
Does it work without the plugin file? We need to strip down where the error lays then.

So just replace the zip contents and try email ( only put a test user in the queue list ) "Hello {$username}"
 
Last edited:
Does it work without the plugin file? We need to strip down where the error lays then.

So just replace the zip contents and try email ( only put a test user in the queue list ) "Hello {$username}"
Yes emailing is working before adding the email zip you have sent and attached.

Is the zip already updated?
 

Basti

Administrator
Staff member
So just replace the zip contents and try email ( only put a test user in the queue list ) "Hello {$username}"
I asked to test with the zip but without the plugin modification. The zip has nothing to do with the plugin, perse, it just add the tag feature to VL

Yes emailing is working before adding the email zip you have sent and attached.
Did you tested with or without the zip?
 
I asked to test with the zip but without the plugin modification. The zip has nothing to do with the plugin, perse, it just add the tag feature to VL


Did you tested with or without the zip?
I did download the email zip , extract , overwrite and test at my end..thats what the error came (the one I've screenshot)
http://visiolist.com/community/attachments/error-png.1139/

Testing without the modification.. text sent is string not tags value.
 

Basti

Administrator
Staff member
For anyone who might have downloaded the zip already.
There was an issue with 1 file and missing css ( you might need to clear your cache after upload )
And the zip is now updated with fixed code

EDIT:: Zip removed since it comes into Visiolist 1.7
 
Last edited:
Top