how to send to several groups each from different sender

3 views
Skip to first unread message

fishnyc22

unread,
Feb 16, 2007, 12:53:01 AM2/16/07
to mimemessage-dev
Hi Manuel.

My application allows for a user to schedule the sending of a message
to their group of subscribers. I have a database that logs their
scheduled messages. Every 30 min I run a cron that queries a DB to see
if there are any queued messages to go out.

It is possible to have several groups of messages that go out. This
would be similar to sending several bulk mail message groups out one
after another in the same script.

for example. I check my DB and see there are 3 users with scheduled
messages during this time.

from us...@domain.com
to: su...@domain1a.com, su...@domain2a.com, su...@domain3a.com,
su...@domain4a.com ...

from us...@domain.com
to: su...@domain1b.com, su...@domain2b.com, su...@domain3b.com,
su...@domain4b.com ...

from us...@domain.com
to: su...@domain1c.com, su...@domain2c.com, su...@domain3c.com,
su...@domain4c.com ...

What I need to do is loop through and each USER and get their
recipient list and send out the message to their subscribers. Each
USER will have a different FROM, and MESSAGE for their outgoing mail.

So I have

START USER LOOP
GET SUBS for USER
SEND MESSAGE
END USER LOOP

I'm not the best programmer and OOP is a bit new to me. Since my USERS
subscriber lists can be very long, I wanted to use your bulk mail
class to send my messages out (utilizing cache body for each users
message). But my problem is that if I drop your class inside that
loop, the qmail_message_class is created each time. I believe this is
causing a problem b/c only the first USERS message is going out.

What would be the proper way to utilize your script in this situation.
Can I clear the class after each pass and recreate it. Is that not a
good idea? Or is there another option. I realize I'm asking for OOP
assistance here. Sorry about that.

Any help is appreciated.

Regards

Dave

Manuel Lemos

unread,
Feb 16, 2007, 8:45:09 PM2/16/07
to mimemes...@googlegroups.com
Hello,

on 02/16/2007 03:53 AM fishnyc22 said the following:


> I'm not the best programmer and OOP is a bit new to me. Since my USERS
> subscriber lists can be very long, I wanted to use your bulk mail
> class to send my messages out (utilizing cache body for each users
> message). But my problem is that if I drop your class inside that
> loop, the qmail_message_class is created each time. I believe this is
> causing a problem b/c only the first USERS message is going out.
>
> What would be the proper way to utilize your script in this situation.
> Can I clear the class after each pass and recreate it. Is that not a
> good idea? Or is there another option. I realize I'm asking for OOP
> assistance here. Sorry about that.

If you are sending messages to large groups, it is recommended to send
separate messages to each user.

If the body of the message does not change, you should use the
cache_body class variable to 1.

The class objects and message composition code should be placed outside
the delivery loop. Look at the test_personalized_bulk_mail.php script
for an example.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

Reply all
Reply to author
Forward
0 new messages