I set up Django Mailer and added the two commands to the crontab:
* * * * * root python /srv/www/cpm/manage.py send_mail >> /srv/www/cpm/cron_mail.log 0,20,40 * * * * root python /srv/www/cpm//manage.py retry_deferred >> /srv/www/cpm/cron_mail_deferred.log
CPM is the directory that holds my Django project.
cron I fired up my Django project and clicked a link that puts around 600 emails onto the Django Mailer queue. The
cron command picked up the queued messages and dutifully started sending the emails.
Each email is addressed to me for now for testing purposes. As expected, emails started pouring in.
However, after about 30 emails, I wanted to stop sending the emails as I wanted to make some changes, and start the process over again (I'm testing the app right now). I went into
MySQL and deleted all the records in the
django_mailer_queuedmessages table, thinking that will stop any further emails.
The emails kept coming.
I then deleted all the records in
django_mailer_messages table, hoping that would stop the emails.
The emails kept coming!
I then deleted all records in every table that starts with
django_mailer... and also commented out the
crontab lines that have
django-mailer in them (the two up above) and restarted
The emails are STILL coming!!
What the heck!? How are they still being sent? Interestingly, each email states that it was sent at the time I clicked
Send All Emails (about an hour ago now) and not when they arrived in my inbox. So, I'm not really sure what is going on or how to stop this onslaught of emails!
Hey look, another email just arrived...
I route all my email through my Google Apps Business email account. I simply connect to Gmail in my Python code in the standard way...
It stopped... finally. I ended up sending a
kill signal to the two processes that had started the
cron commands. The only thing I can think that happened is that the django_mailer had stored all the emails in memory and was sending them from there. I had thought that django-mailer would pick an email off the queue (its own
queue model), send it, then get the next message. This did not seem to be the case since I could delete the entire queue and messages were still sending. Clearly they existed somewhere else other than the queue stored in the MySQL database.
Kind of confusing...