views:

70

answers:

2

I am developing a django application on my MAC. The development server that comes with django is great. However, I installed the django-authopenid (combines django-registration app with openID) which follows the 3 step process: user signs up, app sends a confirmation email with link, and user clicks on link to confirm sign-up.

Since the django development server does not have a mail server, how do I test this confirmation email portion of the process? I followed an idea to print out the contents of the email to the terminal, but I can't follow the link. Any suggestions?

+1  A: 

Python has a debugging mail server available for this purpose.

Just execute this command and you'll have a mailserver running at port 1025

python -m smtpd -n -c DebuggingServer localhost:1025

After that you'll need to change your MAIL_HOST setting in Django and you can test your emails locally :)

WoLpH
ok, so I am running this, but I the link from the email throws an error. The link is: <a href=3D"http://openid-example.e-engura.org/account/activate/e29864d921cd=1455e63a150e6ea122adbbe4a158/">/account/activate/e29864d921cd1455e63a150e6e=a122adbbe4a158/</a>.
rich
Do I need to change this somewhere. Thanks.
rich
That link is generated with the sites framework. In the Django admin you can change the site url to something that will work (like `localhost:8000`)
WoLpH
I changed it in the 'activation_email.txt' file that is used to generate the email. Thanks again!
rich
+1  A: 

If you have a Gmail account, you can use it to send your dev mail. Put the following in your settings.py file:

# django-registration
ACCOUNT_ACTIVATION_DAYS = 7
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'YourGmailPassword'
EMAIL_PORT = 587
DEFAULT_FROM_EMAIL = 'DevBox <[email protected]>'
LOGIN_REDIRECT_URL = '/'
mitchf