Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Mar 2011
    Posts
    364
    Plugin Contributions
    0

    Default throttling newsletter sending

    Is there not a better solution in sending out emails. We have over 5K subscribers and I do not think it all went through.

    I would think there would be a "throttle" configuration to send out 100 emails at a time.

    I know in oscommerce there is a mod that we used to set to send 100 emails at a time but we would have to go back and hit resend to send another 100 emails at a time and the email system would keep a total count track

    here is the mod
    Attached Files Attached Files

  2. #2
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,263
    Plugin Contributions
    3

    Default Re: Weird garbage characters showing up after sending email

    Quote Originally Posted by willie bee View Post
    Is there not a better solution in sending out emails. We have over 5K subscribers and I do not think it all went through.

    I would think there would be a "throttle" configuration to send out 100 emails at a time.

    I know in oscommerce there is a mod that we used to set to send 100 emails at a time but we would have to go back and hit resend to send another 100 emails at a time and the email system would keep a total count track

    here is the mod
    ZC is opensource, and as such you are at liberty to modify / add any component you wish. If you would like a throttle config, then there is absolutely no law in the universe that stops you from coding one.

    Why the expectation that it "should be there"?

    It isn't... and if you want it, then write it.
    20 years a Zencart User

  3. #3
    Join Date
    Jun 2003
    Posts
    33,715
    Plugin Contributions
    0

    Default Re: Weird garbage characters showing up after sending email

    With that many subscribers - I would look at a real contact manager instead of expecting your shopping cart to do everything.
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

  4. #4
    Join Date
    Jun 2008
    Location
    Washington, DC
    Posts
    785
    Plugin Contributions
    7

    Default Re: Weird garbage characters showing up after sending email

    Quote Originally Posted by willie bee View Post
    Is there not a better solution in sending out emails. We have over 5K subscribers and I do not think it all went through.

    I would think there would be a "throttle" configuration to send out 100 emails at a time.
    I have been using this hack I did a long time ago. It is not pretty but works.

    Use at your own risk.

    admin/includes/modules/newsletters/newsletter.php

    Around line 89 to look like this:
    Code:
        function send($newsletter_id) {
          global $db;
          $audience_select = get_audience_sql_query($this->query_name, 'newsletters');
          $audience = $db->Execute($audience_select['query_string']);
          $records = $audience->RecordCount();
          if ($records==0) return 0;
        $i=0;
        // There is a 600 second time limit set for email in
        // admin/newsletters.php line 359 might have to increase 
        // if more then 1500 newsletters
        // add sleep after ## emails
        $slp=0;
    
          while (!$audience->EOF) {
        $i++;
        $slp++;
          $html_msg['EMAIL_FIRST_NAME'] = $audience->fields['customers_firstname'];
          $html_msg['EMAIL_LAST_NAME']  = $audience->fields['customers_lastname'];
          $html_msg['EMAIL_MESSAGE_HTML'] = $this->content_html;
          zen_mail($audience->fields['customers_firstname'] . ' ' . $audience->fields['customers_lastname'], $audience->fields['customers_email_address'], $this->title, $this->content, STORE_NAME, EMAIL_FROM, $html_msg, 'newsletters');
          echo zen_image(DIR_WS_ICONS . 'tick.gif', $audience->fields['customers_email_address']);
    
          //force output to the screen to show status indicator each time a message is sent...
          if (function_exists('ob_flush')) @ob_flush();
          @flush();
    	
    		if ($slp >= 50) { // sleep after 50 emails
    	  		sleep(15); // sleep 15 seconds
    	  		$slp=0;
    		}
    
    
          $audience->MoveNext();
          }

    Skip
    • 446F63746F722057686F •

  5. #5
    Join Date
    Mar 2011
    Posts
    364
    Plugin Contributions
    0

    Default Re: Weird garbage characters showing up after sending email

    Thanks again skip. One question and im asking ahead of time when i shouldnt. but after i put this code in is there a way to run a test to see if it actually works because some of us stink
    at modifying code.
    thanks so much and i hope yall had a good thanksgiving.

  6. #6
    Join Date
    Jun 2008
    Location
    Washington, DC
    Posts
    785
    Plugin Contributions
    7

    Default Re: Weird garbage characters showing up after sending email

    Quote Originally Posted by willie bee View Post
    Thanks again skip. One question and im asking ahead of time when i shouldnt. but after i put this code in is there a way to run a test to see if it actually works because some of us stink
    at modifying code.
    thanks so much and i hope yall had a good thanksgiving.
    Yes with more work.

    I use this All Administrators hack to communicate information between all the admins of a ZC site. But it is used as a newsletter and email testing bed also.

    1. You will need 4 to 8 email address that you have access to.
    2. Each email you have you will create a ZC admin account for each. (Tools->Admin Settings)
    3. Using phpmyadmin locate query_builder table now find the record with mail,newsletters : Administrator in it and copy the whole record to create a new record with the information.
    4. Open the new record and edit the field query_name and query_string:
    From this query_name
    Code:
    Administrator
    To
    Code:
    All Administrators
    From this query_string
    Code:
    select 'ADMIN' as customers_firstname, admin_name as customers_lastname, admin_email as customers_email_address from TABLE_ADMIN where admin_id = $SESSION:admin_id
    To this
    Code:
    select 'ADMIN' as customers_firstname, admin_name as customers_lastname, admin_email as customers_email_address from TABLE_ADMIN
    5. Now when you go to send newsletters in the dropdown you will see a new listing All Administrators. (These are the emails of all the admin accounts.)
    6. Based on how many email address you have in the ZC admin accounts. Is how many emails per sleeps we set in the hack.
    Example: You have 6 admin account email address. You want to sleep after 2 emails.
    Change from this
    Code:
    if ($slp >= 50) { // sleep after 50 emails
    To this
    Code:
    if ($slp >= 2) { // sleep after 50 emails
    7. After testing you will set $slp back to 50 or if you want 100 etc.

    As always backup your work.

    Skip
    • 446F63746F722057686F •

  7. #7
    Join Date
    Mar 2011
    Posts
    364
    Plugin Contributions
    0

    Default Re: Weird garbage characters showing up after sending email

    Quote Originally Posted by skipwater View Post
    Yes with more work.

    I use this All Administrators hack to communicate information between all the admins of a ZC site. But it is used as a newsletter and email testing bed also.

    1. You will need 4 to 8 email address that you have access to.
    2. Each email you have you will create a ZC admin account for each. (Tools->Admin Settings)
    3. Using phpmyadmin locate query_builder table now find the record with mail,newsletters : Administrator in it and copy the whole record to create a new record with the information.
    4. Open the new record and edit the field query_name and query_string:
    From this query_name
    Code:
    Administrator
    To
    Code:
    All Administrators
    From this query_string
    Code:
    select 'ADMIN' as customers_firstname, admin_name as customers_lastname, admin_email as customers_email_address from TABLE_ADMIN where admin_id = $SESSION:admin_id
    To this
    Code:
    select 'ADMIN' as customers_firstname, admin_name as customers_lastname, admin_email as customers_email_address from TABLE_ADMIN
    5. Now when you go to send newsletters in the dropdown you will see a new listing All Administrators. (These are the emails of all the admin accounts.)
    6. Based on how many email address you have in the ZC admin accounts. Is how many emails per sleeps we set in the hack.
    Example: You have 6 admin account email address. You want to sleep after 2 emails.
    Change from this
    Code:
    if ($slp >= 50) { // sleep after 50 emails
    To this
    Code:
    if ($slp >= 2) { // sleep after 50 emails
    7. After testing you will set $slp back to 50 or if you want 100 etc.

    As always backup your work.

    Skip
    Looks like that worked but I do not think all 5K emails got the newsletter.

    Tell me if I am wrong.

    On the next newsletter should I create a new fake account and send out the newsletter again and if that LAST account got the newsletter then it all went through?

    I'm thinking the newsletter goes out in order of the accounts, from oldest to newest. TIA.

  8. #8
    Join Date
    Jun 2008
    Location
    Washington, DC
    Posts
    785
    Plugin Contributions
    7

    Default Re: Weird garbage characters showing up after sending email

    You missed the math:
    // There is a 600 second time limit set for email in
    // admin/newsletters.php line 359 might have to increase
    // if more then 1500 newsletters

    5000 / 1500 = 3.3 so you need 3x more time +

    You will need to up the time limit in the file admin/newsletters.php about line 359 to 4 x 600 = 2400

    Skip
    • 446F63746F722057686F •

  9. #9
    Join Date
    Mar 2011
    Posts
    364
    Plugin Contributions
    0

    Default Re: Weird garbage characters showing up after sending email

    Thanks, but does what I say about how ZC sends out newletters hold true? By oldest email up to newest?

    I guess this way others reading this thread can do the same and create a mock account with their email and see if they get it in the end.

  10. #10
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Weird garbage characters showing up after sending email

    By default Zen Cart doesn't implement ANY sort order for newsletter subscribers, so thus it relies completely on the order determined most appropriate by the MySQL database.

    If you want to change the order, you'll need to change the SQL statements in the various queries in the query_builder table of your database. You'll need to use your own database tools to do that, such as phpMyAdmin. BE CAREFUL when touching raw database content. MAKE BACKUPS first.
    Naturally, I recommend that if you've not used such tools before that you should NOT start using them now merely for this. USE AT OWN RISK.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v138a Newsletter Sending Hangs
    By beyerg in forum General Questions
    Replies: 0
    Last Post: 10 Mar 2015, 06:53 PM
  2. Newsletter - Cron sending
    By DarkMen in forum Customization from the Admin
    Replies: 1
    Last Post: 2 Oct 2014, 02:38 PM
  3. Warning sending newsletter
    By 100asa in forum General Questions
    Replies: 1
    Last Post: 10 Sep 2008, 10:26 AM
  4. Sending Newsletter Question
    By jacque427 in forum General Questions
    Replies: 0
    Last Post: 8 Jul 2007, 05:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR