I had some trouble sending email confirmation messages in Pinax from WebFaction:

(productionenv)[user@web]$ python manage.py retry_deferred
2 message(s) retried
(productionenv)[user@web]$ python manage.py send_mail
------------------------------------------------------------------------
acquiring lock...
acquired.
sending message 'Confirm e-mail address for Pinax' to user1@example.com
message deferred due to failure: {'user1@example.com': (504, '5.5.2 <webmaster@localhost>: Sender address rejected: need fully-qualified address')}
sending message 'Confirm e-mail address for Pinax' to user2@example.com
message deferred due to failure: {'user2@example.com': (504, '5.5.2 <webmaster@localhost>: Sender address rejected: need fully-qualified address')}
releasing lock...
released.
 
0 sent; 2 deferred;
done in 0.20 seconds
(productionenv)[user@web]$

The secret to debugging this is to note that ‘webmaster@localhost‘ is the cause of the rejection. If you did not configure your smtp.EMailBackend settings before you added the initial batch of users, then all the messages get stored with the default value ‘webmaster@localhost‘ (instead of pinax@example.com or whatever) and your mail exchanger will complain. In your Pinax/Django settings file you should have something similar:

# Email configuration
DEFAULT_FROM_EMAIL = 'Pinax <pinax@example.com>'
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.webfaction.com'
EMAIL_HOST_USER = 'pinax_emailer' # Mailbox name from https://my.webfaction.com/mailbox/list
EMAIL_HOST_PASSWORD = 'password_goes_here'
EMAIL_PORT = 25
EMAIL_SUBJECT_PREFIX = '[Pinax] '

To solve this problem, you need to remove the deferred messages in the queue. You can do this by removing the rows in the ‘mailer_message’ table in your database. You could also remove the entries under the appropriate Django admin page (/admin/mailer/message/). Either way, you need to get rid of those messages because they are from webmaster@localhost and not pinax@example.com. If you don’t, they will be deferred forever and ever and evar and evaaarrr.

Once the offending messages have been removed, you can reverify another email and it will send out the verification email without issues:

$ python manage.py send_mail
------------------------------------------------------------------------
acquiring lock...
acquired.
sending message 'Confirm e-mail address for Pinax' to shoe@example.com
releasing lock...
released.
 
1 sent; 0 deferred;
done in 0.19 seconds

Tags: ,