Issue #3 resolved

Mail dispatch should be a method of the target, not the campaign

Owen Nelson
repo owner created an issue

It occurred to me that if there is an error during bulk dispatch, we have no record of which of the targets had mail sent to them, or which of the targets caused the send error (if applicable).

Moving the responsibility of the email sending to the target instance, rather than the campaign, opens up some interesting doors.

  • Per target dispatch timestamps
  • Can send mail out to some, not all, of the targets, at a time.

We'll need to revise some of the ideas in place for dispatch times, etc, but I think this will be cleaner, and more sensible.

Comments (2)

  1. Owen Nelson reporter

    We can actually leave the ``bulk_dispatch`` method with the campaign, but just rewrite it to iterate over each target and call each ``target.dispatch()`` method. This would basically mean ``dispatch()`` will not need any parameters at all (since the target params will be properties of ``self``).

    I'm not sure if the ORM will cache references to the target's ``self.campaign instance``, but if need be, we can instantiate the campaign and pass it in to dispatch as an optional arg. I'll have to do some testing to count the queries I think.

  2. Log in to comment