Email Blasting

Discussion in 'General Help' started by softdevsalon, Feb 25, 2019.

  1. softdevsalon
    • Licensed

    softdevsalon Member

    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?
  2. Basti
    • Staff

    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
  3. softdevsalon
    • Licensed

    softdevsalon Member

    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
  4. softdevsalon
    • Licensed

    softdevsalon Member

    Is there any available tag or alternative you can give?
  5. Basti
    • Staff

    Basti Administrator Staff Member

    Not at the moment no, you need to wait till I made proper changes
    softdevsalon likes this.
  6. cajkan
    • Licensed

    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
  7. softdevsalon
    • Licensed

    softdevsalon Member

    Can you show me how to do it?
  8. Basti
    • Staff

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

    Attached Files:

    Last edited: May 8, 2019
    Mark and cajkan like this.
  9. softdevsalon
    • Licensed

    softdevsalon Member


    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?
  10. Basti
    • Staff

    Basti Administrator Staff Member

    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

    Not sure what you mean here? Go to admin - > email members and write your email with the tags include
  11. softdevsalon
    • Licensed

    softdevsalon Member

    Email is not working..I have to revert the old files.
    see error message screenshot

    Attached Files:

  12. Basti
    • Staff

    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: May 7, 2019
  13. softdevsalon
    • Licensed

    softdevsalon Member

    Yes emailing is working before adding the email zip you have sent and attached.

    Is the zip already updated?
  14. Basti
    • Staff

    Basti Administrator Staff Member

    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?
  15. softdevsalon
    • Licensed

    softdevsalon Member

    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.
  16. Basti
    • Staff

    Basti Administrator Staff Member

  17. softdevsalon
    • Licensed

    softdevsalon Member

  18. Basti
    • Staff

    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

Share This Page