Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / Is there any way send out a specific number of newsletters per hour?

Is there any way send out a specific number of newsletters per hour?

Locked
This thread is locked. New replies are disabled.
16 Nov 2008, 2:00 PM
#1
bryanb3 avatar

bryanb3

New Zenner

Join Date:
Nov 2008
Posts:
11
Plugin Contributions:
0

Post #1 by bryanb3

Hello:

Is there any way to send out say 400 newsletters per hour out of Zen Cart instead of sending all at once?

My host restricts sending emails to 500 per hour.

Sincerely,
Bryan
https://www.profitmart101.com

16 Nov 2008, 2:24 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #2 by drbyte

At the present time there is no built-in way of throttling the number of outbound emails.
You'd need an external tool to do that, such as the one I discuss here: http://www.zen-cart.com/forum/showthread.php?p=216150#post216150

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

16 Nov 2008, 6:03 PM
#3
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,771
Plugin Contributions:
56

Post #3 by swguy

At some point it may make sense to get a separate email service provider to handle your bulk mail needs so you don't get in trouble with your host. I recommend MailChimp, but many people have good experiences with Constant Contact or AWeber.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

18 Nov 2008, 3:45 AM
#4
bryanb3 avatar

bryanb3

New Zenner

Join Date:
Nov 2008
Posts:
11
Plugin Contributions:
0

Post #4 by bryanb3

Thanks for all the help.

Sincerely,
Bryan
https://www.profitmart101.com

7 Dec 2008, 12:34 PM
#5
brushwoodnursery avatar

brushwoodnursery

Zen Follower

Join Date:
Dec 2006
Posts:
199
Plugin Contributions:
0

Post #5 by brushwoodnursery

For regular newsletters, my vote is for phplist. I found this thread because I'm researching a way to throttle back product notifications. I restock in big batches due to the nature of my business. Right now, I'm about to send a batch but I wanted to know if adding

sleep(x)
```into the loop would manually slow things. I don't care if it takes all night to process the notifications. I just don't want to anger the customers' hosts and get blocked.
16 Dec 2008, 6:23 AM
#6
seacindy avatar

seacindy

New Zenner

Join Date:
Dec 2008
Posts:
3
Plugin Contributions:
0

Post #6 by seacindy

Yes, there is a application written for Zen Cart that will do that:
epishire.com

It will send out emails at 1 per 8 seconds right from the Newsletter Manager.

8 Feb 2009, 11:15 PM
#7
npn2531 avatar

npn2531

New Zenner

Join Date:
Feb 2009
Posts:
5
Plugin Contributions:
0

Post #7 by npn2531

Yes, there is. I have written a program for Zen Cart that I have used for about a couple of months that sits in the Newsletter Manager, and will send out 1 newsletter (email) per X seconds to either all customers or to newsletter subscribers. X can be whatever you like. If X is 8 it sends out 480 emails per hour, perfect for shared host websites. I have added a counter to it, so you can watch it's progress. It's pretty easy to install. The best part is that it pulls directly out the database, eliminating the need to maintain a separate database for emailing or for creating newsletters in an outside program. If there was an interest in this program I will post it as a contribution, as I would very much like to see how more experienced programmers could improve on it.

I regularly have been using it to send out to my list of about 6000, and it seems pretty bullet proof. However, if there was a way to add processing of bounced emails and other features like that it could approach being a full featured bulk email program that sits right in Zen Cart

19 Feb 2009, 4:27 PM
#8
terjekj avatar

terjekj

New Zenner

Join Date:
Dec 2008
Posts:
9
Plugin Contributions:
0

Post #8 by terjekj

I'd be glad to make use of this mod. I'm sending 17000 emails, and need to put some delays into the sending ..

23 Feb 2009, 7:19 PM
#9
mgrunk avatar

mgrunk

New Zenner

Join Date:
Feb 2007
Posts:
53
Plugin Contributions:
0

Post #9 by mgrunk

npn2531:

Yes, there is. I have written a program for Zen Cart that I have used for about a couple of months that sits in the Newsletter Manager, and will send out 1 newsletter (email) per X seconds to either all customers or to newsletter subscribers. X can be whatever you like. If X is 8 it sends out 480 emails per hour, perfect for shared host websites. I have added a counter to it, so you can watch it's progress. It's pretty easy to install. The best part is that it pulls directly out the database, eliminating the need to maintain a separate database for emailing or for creating newsletters in an outside program. If there was an interest in this program I will post it as a contribution, as I would very much like to see how more experienced programmers could improve on it.

I regularly have been using it to send out to my list of about 6000, and it seems pretty bullet proof. However, if there was a way to add processing of bounced emails and other features like that it could approach being a full featured bulk email program that sits right in Zen Cart

Is there a link available and / or more details?

Thanks.

30 Nov 2009, 4:25 AM
#10
scubasteve avatar

scubasteve

New Zenner

Join Date:
Oct 2005
Posts:
54
Plugin Contributions:
0

Post #10 by scubasteve

At approximately line 108 in the admin/includes/modules/newsletters/newsletter.php file you will find the following:

  //force output to the screen to show status indicator each time a message is sent...
  if (function_exists('ob_flush')) @ob_flush();
  @flush();
  
  $audience->MoveNext();
  }

I changed mine to this:

  //force output to the screen to show status indicator each time a message is sent...
  if (function_exists('ob_flush')) @ob_flush();
  @flush();
  // Delay code to slow emails
  zen_set_time_limit(60); //reset timeout limit to avoid timeouts in long email sends
  // Delay time calculation is number of seconds in between email sends. 3600 seconds divide 80% of server email limit. 
  sleep(3600/(350 * 0.8)) ;

  $audience->MoveNext();
  }

There are other ways to approach this with setting the 250 emails per hour as a variable instead of a hard coded number. Test it on a smaller batch to start with to make sure you get it right before you send off 1000's of email and blow the server limits. This example should result in approximately 280 emails per hour leaving overhead for 70 normal outgoing and incoming messages an hour.

30 Nov 2009, 4:35 AM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #11 by drbyte

scubasteve:

// Delay code to slow emails
zen_set_time_limit(60); //reset timeout limit to avoid timeouts in long email sends
// Delay time calculation is number of seconds in between email sends. 3600 seconds divide 80% of server email limit.
sleep(3600/(350 * 0.8)) ;
NOTE: Not all servers can handle that.
ie: some hosts prevent altering the timeout limit or setting it higher than a certain value
ie: some hosts have scripts set up to kill scripts that run longer than the threshold set
ie: many hosts will lose their database connection during such a long activity time, or will flag your application as taking too long to complete or using too much database/CPU time.

That said, if it works for you, great ... but if someone tries it and it doesn't suit them, at least they've been warned :blush:

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