<h3>Bulk Mail
</h3>Bulk mail allows us to send an email to a set of users. The main proc that does the sending is bulk_mail::new
. Bulk mail has almost no user interface except for the little info on sent mails. So UI was added to in in dotLRN dotlrn-bm
ads a list of the bulk mail history while dotlrn
offers a UI to actually send emails to defined parties (groups and persons).
bulk_mail::new
proc is very generic. You can pass a subject
and must pass a from_addr
and a message
but the query
switch can change them all. This SQL query is used to dynamically manipulate subject
and message
. The value of a returned column (i.e. 'foo
') replaces ever occurrence of '{foo}
'. The query must return an email
column and optionally the columns from_addr
, reply_to
, subject
and message
.
Bulk mail is an acs object and creates new objects using the proc
package_instantiate_object -extra_vars $extra_vars "bulk_mail_message"
which calls the stored procedure
bulk_mail__new
. The
extra_vars
variable is a
ns_set
which is accessed by
bulk_mail::sweeper
directly which luckily uses
acs_mail_lite::send
to send the emails. Thus they are also stored in
acs_mail_lite_queue
.
Bulk mail also has logging functionalities. All emails that are to be sent out are stored in the table bulk_mail_messages
. Once the bulk mail is sent the flag sent_p
is set to 1
.
Like mailing list bulk mail can have any email address as the sender (from_addr
). Therefore storing the sender's email and not a user id seems better. On the other hand the receivers ids are well known due to the fact that they are coming from the SQL query
-attribute passed to bulk_mail::new
.
Now bulk mail iterates over all receivers and calls acs mail lite to send the email. Therefore we have many entries that contain almost the same content. Almost because each mail is customized depending on the interpolation that takes place. If we want to store the email once we will loose the customized content depending on the SQL query and we need to change bulk mail not to call acs mail lite for each recepient. But from what I can see acs mail lite does not support a list of receivers anyway.
<h3>ACS Mail Lite - revisited (2)
</h3>ACS mail lite supports sending emails immediately with the private proc acs_mail_lite::send_immediately
. This proc only queues an email if acs_mail_lite::deliver_mail
fails somehow. So if we have packages that uses acs_mail_lite::send_immediately
directly we have no way to find out.
Since the sweeper runs every minute I don't see why we should deal acs_mail_lite::send_immediately
differently to acs_mail_lite::send
. We should simply insert that email to the queue and we are set. Any comments?