Задать вопрос

Тел: +7 965 3737 888





Import mail into a Django model

A mildly crufty script to slurp mail from an mbox into a Django model. I use a variant of this script to pull the contents of my scammy-spam mbox into the database displayed at http://purportal.com/spam/

Вопрос полезен? Да0/Нет0

Ответы (3):

Ответ полезен? Да0/Нет0

Oh, and it also has a gratuitous hardcoded reference to MySQLdb, simply because the DB was frequently barfing on bad dates (the mail I'm processing with this is spam). One could certainly find a way to catch that without resorting to a DB-specific reference.

Ответ полезен? Да0/Нет0

Yes, it's definitely Unix-specific. I'll leave writing a generalized version as an exercise for the reader, since it would likely quadruple in size (and not be any more useful to me personally!).

Ответ полезен? Да0/Нет0

Great idea! But it seems to broke one of the main python power - one language, many platforms (of course IMHO :). This will be usable only for Unix-like OS'es. An option for me is to connect to POP3 and get all data from there.