NYCPHP Meetup

NYPHP.org

[nycphp-talk] php for mailing list app?

Anirudh Zala arzala at gmail.com
Tue Jun 27 04:24:35 EDT 2006


Hi Robyn,

It seems that basically there is not such package that can satisfy all  
your needs. So either you may combine different different  
packages/software that can serve your purpose or design your own custom  
application.

Your custom application's logic can be divided into 4 steps (scripts)

1: mailScheduler.php
2: sendMail.php
3: checkBounceMail.php
4: mailLog.php

1st and 4th script are intended to run from browser, while 2nd and 3rd are  
 from CLI. Logic can be as mentioned below:

+> "mailScheduler.php" will determine how many mails are to be sent, to  
whom, what content will be etc. It can be, in fact, your regular script  
that can generate above information. Instead of sending those mails  
directly (which is your 1st problem domain), store them in database as it  
is. (i.e in various fields like mail_to, mail_from, mail_content,  
mail_status, date_send etc.) In short mailScheduler.php will insert mail  
related information into database with mail_status=Q (Q means queue).

+> As soon as insertion of data is finished, you can call script  
"sendMail.php" to run from CLI from above script using many methods like  
using functions, using Backtick operator etc. (about how to run PHP script  
in background from command line by executing that command from script  
running in browser). Read reply of "drydell at optonline.net". This script  
will simply read those inserted content from database, maybe do some other  
foo stuffs, and will start sending mail and then it will set value of  
field mail_status=S (S means sent). If you have 10 000 mails to be sent  
then it wont take more than 15 minutes to finish execution in normal case.

+> As soon as execution of above script is finished, either you can call  
3rd script "checkBounceMail.php" immediately from above running CLI script  
to check whether any mails are bounced or not by checking mails from that  
account or schedule that script in Cron to check bounced mail at every  
hour and parsing content of bounced mail and marking status of field  
mail_status=B (B means bounced)

+> 4th script is special script which will manually read content from  
database, at any stage during execution of any 1st, 2nd or 3rd script, and  
will list status of all mails whether Q or S or B according to value of  
filed mail_status (and other information if required). Since this is  
manual script it will need to be clicked in browser in order to display  
desired results. Alternatively if you want automatic results then you can  
make this script to be run from CLI and set it's execution time in Cron  
and it will then notify results via email etc.

By this way, I think within an hour everything will be scanned and report  
can be generated. There are also many other issues to be handled while  
sending mass mails like setting bounced mail address, how to read bounced  
mails etc. but since you have not asked, no need to reply at this moment.

Thanks

Anirudh Zala

On Mon, 26 Jun 2006 23:15:50 +0530, robyn overstreet <robynover at gmail.com>  
wrote:

> On 6/26/06, Donald J Organ IV <dorgan at optonline.net> wrote:
>> Well create a cron job that runs every x amount of minutes that looks
>> for messages that have say the Send field set to 1 in the database.
>
> Great! That makes sense.
>
> Still wondering how to let the user know the status of the process
> from the browser. Obviously, the browser PHP could check the database
> repeatedly to see if the send field is set to 0, but that might create
> a long wait also. Additionally, is it reasonable to query the database
> in a cron job every minute? Every 5 minutes? The client will probably
> only use the app weekly or monthly, but of course it needs to be ready
> at any time.
>
> TIA
> Robyn
>
>> robyn overstreet wrote:
>> > On 6/26/06, Donald J Organ IV <dorgan at optonline.net> wrote:
>> >
>> >> I believe that if you run the script that sends the emails from the
>> >> command line using say cron that the PHP has no max execution time.
>> >> This may help.
>> >>
>> >
>> > Thank you. That's helpful. It makes sense that if I run the script
>> > behind the scenes, not only will it not time out, but the user won't
>> > be affected by the 'long' time it takes to send mail. Since I'm
>> > writing a web application, though, I don't think cron will help -- I
>> > need to run the script (not in the browser) when the user hits "send
>> > to subscribers". Any suggestions on how to do this?
>> >
>> > Thanks
>> > Robyn
>> >
>> >
>> >
>> >> robyn overstreet wrote:
>> >>
>> >>> Hi all-
>> >>> I'm working on a mailing list (announcement only) for a client and  
>> I'm
>> >>> trying to decide if using PHP is the way to go. I'm more comfortable
>> >>> with PHP than with Perl, but it seems that Perl has better email
>> >>> handling modules available.
>> >>>
>> >>> When I've worked with PHP mail() before, my experience was that  
>> even a
>> >>> relatively small list of about 50 addresses took a while to loop
>> >>> through and send. I'm concerned that the server will time out for a
>> >>> larger list. I'm wondering if I need to make a socket connection.
>> >>>
>> >>> Can anyone point me in a good direction to research?
>> >>>
>> >>> Thanks in advance-
>> >>> Robyn
>> >>> _______________________________________________
>> >>> New York PHP Community Talk Mailing List
>> >>> http://lists.nyphp.org/mailman/listinfo/talk
>> >>> New York PHP Conference and Expo 2006
>> >>> http://www.nyphpcon.com
>> >>> Show Your Participation in New York PHP
>> >>> http://www.nyphp.org/show_participation.php
>> >>>
>> >>>
>> >>>
>> >>>
>> >> _______________________________________________
>> >> New York PHP Community Talk Mailing List
>> >> http://lists.nyphp.org/mailman/listinfo/talk
>> >> New York PHP Conference and Expo 2006
>> >> http://www.nyphpcon.com
>> >> Show Your Participation in New York PHP
>> >> http://www.nyphp.org/show_participation.php
>> >>
>> >>
>> > _______________________________________________
>> > New York PHP Community Talk Mailing List
>> > http://lists.nyphp.org/mailman/listinfo/talk
>> > New York PHP Conference and Expo 2006
>> > http://www.nyphpcon.com
>> > Show Your Participation in New York PHP
>> > http://www.nyphp.org/show_participation.php
>> >
>> >
>> >
>>
>> _______________________________________________
>> New York PHP Community Talk Mailing List
>> http://lists.nyphp.org/mailman/listinfo/talk
>> New York PHP Conference and Expo 2006
>> http://www.nyphpcon.com
>> Show Your Participation in New York PHP
>> http://www.nyphp.org/show_participation.php
>>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
> New York PHP Conference and Expo 2006
> http://www.nyphpcon.com
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php



-- 
-----------------------------------------------
Anirudh Zala (Project Manager)
ASPL, http://www.aspl.in
Ph: +91 281 245 1894
arzala at gmail.com
-----------------------------------------------



More information about the talk mailing list