CodeIgniter Forums
Question about e-mail sending app, send 50, wait 15 min. sendo more 50... - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Question about e-mail sending app, send 50, wait 15 min. sendo more 50... (/thread-7399.html)



Question about e-mail sending app, send 50, wait 15 min. sendo more 50... - El Forum - 04-07-2008

[eluser]Rubiz'[/eluser]
Hi there!

Well, I'm confusing about how develop an app.
It will be an e-mail sender, so there must be lists with 100 or 5000 e-mails to send and it will be: if I send one by one, when I get 51 e-mails sent the server will get this as spam, and will break my e-mail sending.

So I have to send 50, wait for 15 minutes... send more 50, wait for 15 minutes...

The question is, how can I do that?


Question about e-mail sending app, send 50, wait 15 min. sendo more 50... - El Forum - 04-07-2008

[eluser]Pascal Kriete[/eluser]
The easiest way to solve this is with a cron job. The other alternative is making a js script that refreshes every 15 minutes, but that tends to be unreliable and you would probably have to set the timeout to something closer to 20.


Question about e-mail sending app, send 50, wait 15 min. sendo more 50... - El Forum - 04-07-2008

[eluser]Rick Jolly[/eluser]
Yes, a cron job as inparo suggested. You'll find lots of info if you do a search for mass email in this forum. There is some info here:http://ellislab.com/forums/viewthread/62395/

You could do something simple like this:

1) Set a cron job to call your script every 15 minutes. On a most hosts you can set a cron job through the control panel or ssh if enabled. There are also third-party sites where you can register scheduled tasks to call your script.
2) Queue email info as rows in a database. Either queued by auto-increment id or timestamp.
3) When your script is called, get the oldest 50 email rows from your database using order by and limit of 50.
4) Send the emails and update each row with a flag to indicate the email is sent or simply delete the row.


Question about e-mail sending app, send 50, wait 15 min. sendo more 50... - El Forum - 04-08-2008

[eluser]Rubiz'[/eluser]
Thanxs for answering Inparo e Rick Jolly, I have read this post, it seems this subject is frequently asked!
And same senior developers have to think about better solutions for it.

A friend of mine told me about javascript functions, like setInterval and seTimeout, I could launch PHP by this, instead of get a refresh meta tag refreshing the browser all time.

1. Get and send 50 e-mails, keeping the last e-mail id sent.
2. PHP calls a time javascript function
3. After 15 min javascript calls the responsible controller and the process inits again...

You think this can be a fine solution?


Question about e-mail sending app, send 50, wait 15 min. sendo more 50... - El Forum - 04-08-2008

[eluser]Rick Jolly[/eluser]
[quote author="Rubiz’" date="1207679893"]Thanxs for answering Inparo e Rick Jolly, I have read this post, it seems this subject is frequently asked!
And same senior developers have to think about better solutions for it.

A friend of mine told me about javascript functions, like setInterval and seTimeout, I could launch PHP by this, instead of get a refresh meta tag refreshing the browser all time.

1. Get and send 50 e-mails, keeping the last e-mail id sent.
2. PHP calls a time javascript function
3. After 15 min javascript calls the responsible controller and the process inits again...

You think this can be a fine solution?[/quote]
The answer is cron. There is no better solution.


Question about e-mail sending app, send 50, wait 15 min. sendo more 50... - El Forum - 04-09-2008

[eluser]Rubiz'[/eluser]
Hmmm but I really dont know what u mean when you tell about it... I dont know it, its a feature?


Question about e-mail sending app, send 50, wait 15 min. sendo more 50... - El Forum - 04-09-2008

[eluser]Myles Wakeham[/eluser]
You might want to download PHPList and look at its code (its open source). It does exactly what you are asking for, and has features to control the rate of sending emails as my PHP Hosting sites will place limits on the max number of emails they will allow you to send per hour. Its not a CI solution, but it does what you are requesting and you could adapt its code to your needs.

Myles


Question about e-mail sending app, send 50, wait 15 min. sendo more 50... - El Forum - 04-10-2008

[eluser]Rubiz'[/eluser]
Thanx Myles Wakeham!! I'll be looking their site and analyse how their framework works.


Question about e-mail sending app, send 50, wait 15 min. sendo more 50... - El Forum - 04-10-2008

[eluser]Thoer[/eluser]
I'm not sure how fast you need this, but I'm pretty close to releasing a similar open source application, based on codeigniter and codeextinguisher. I'm done with my Hungarian docs and about to start the English one. It would still make a lot of sense to add the job of sending out emails to the cron, but it will do well without it. It will share a lot of features with phplist. It sure won't be THAT mature for a while though.


Question about e-mail sending app, send 50, wait 15 min. sendo more 50... - El Forum - 04-10-2008

[eluser]Rubiz'[/eluser]
Hmm, I'll work on it tomorrow... really fast, but tell me when its done, I'll love to know it!!