Here is my campaign app model. There are bits of icelandic there but
nothing to hamper understanding i hope.
It's a three-way Email, Campaign, Dispatch.
For my purposes I've hard-coded a template into the Dispatch.send()
method where the actual emailing gets done. Ideally it should be
multipart and send a plain-text along with it. The email address of
each user is put into the email for an unsubscribe link. Again -
ideally this should be a unique hash key do couple the unregistration
with the email that was used to unregister. Custom templates would be
nice for differently themed emails.
The way I've done this everything is controlled in the django admin.
Campaign.dispatched() gives you the completed percentage etc.
As described on django-users there is a cronjob running a tiny script:
http://dpaste.com/16353/
Hope this is useful to your goals. I'm really interested in what
functionality you're looking for passed what I have down in my puny
little app.
>
> http://dpaste.com/16350/
>
> Here is my campaign app model. There are bits of icelandic there but
> nothing to hamper understanding i hope.
Ah, you're Icelandic. That explains my inability to classify in my
own mind whether your name was Danish, Norwegian or Swedish.
Auðunsson just didn't fit my naïve mental model :-)
James
> It's impressive you were even trying to distinguish it apart from
> the other -"son" countries!
The ö ruled out Danish or Norwegian. So I was all ready to assume
Swedish when I saw the ð. I was fairly confident Swedish didn't have
a ð. I forgot Icelandic did.
Sorry to everyone else -- I'm a linguist by training and can't resist
this sort of thing :-)
> Did you have a look at the code? Something I forgot to note is that
> it hasn't gone through rigorous testing at all. The first site that
> will use it was just put live yesterday. In the coming weeks there
> will hopefully be some mailings.
Looking at it now.
I can see from your Email model why you didn't understand the "don't
send list" at first. Because you have a separate list of email
address, you're solving the same problem a different way. The main
difference is you know about all your emails addresses internal to
your system whereas (at least at the lowest layer of the
architecture) my system just gets given email addresses.
Campaign is very similar to what I was considering as the model that
groups the mailing of the same template in bulk. Obviously your
Campaign is tied to a domain object -- Event -- which mine won't do.
Am I right in thinking that if you have a "preview", the campaign
message is sent to just that address but if it's blank, it's sent to
every active email address? So to send a campaign out, you simply
remove the preview address and re-save?
Dispatch is most closely related to what I have done.
Regarding templates, I was thinking that my equivalent of your
Campaign model would contain the name of the template to use, rather
than it be hard-coded in the dispatch. I presume to send different
email for different campaigns, you currently need conditional logic
in your template itself (as you pass in the campaign object in the
context).
I'll probably "borrow" some ideas from your code.
One thing that will be interesting to see is whether django-mailer,
when a little further along, can support exactly your use case. I
certainly intend it to do so.
James
But I do want django-mailer to be general purpose enough that it can
be used for large scale mail outs.
A layered approach, along with suitable defaults, means we should be
able to get the best of both worlds in terms of simplicity of
implementing the simple cases and extensibility for the complex cases.
James