I am running a django site on a fedora server (Fedora 15 release (Lovelock)) using Apache and mod_wsgi. I recently tried to add a registration system using the django registration application (version 0.7), but unfortunately, I get permission "[Errno 13] Permission denied" when the application tries to send an email confirmation to a new registered user. I configured my project settings file to send emails using a gmail account as follows:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_USE_TLS = True EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_USER = ' myemailaddress@gmail.com ' EMAIL_HOST_PASSWORD = 'mypassword' EMAIL_PORT = 587
I can send emails when I manually import send_mail when using the project shell. I have not changed anything in the views or models. here is the registration template file:
{% extends "base.html" %} {% load i18n %} {% block content %} <form method="post" action="/accounts/register/"> {% csrf_token %} {{ form }} <input type="submit" value="Register"/> </form> {% endblock %}
and here is the error I get:
[Errno 13] Permission denied Request Method: POST Request URL: http://myip/accounts/register/ Django Version: 1.3.1 Exception Type: error Exception Value: [Errno 13] Permission denied Exception Location: /usr/lib64/python2.7/socket.py in create_connection, line 571
this is the full trace:
Traceback:
File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
111. response = callback (request, * callback_args, ** callback_kwargs)
File "/.../lib/registration/views.py" in register
148. new_user = form.save (profile_callback = profile_callback)
File "/.../lib/registration/forms.py" in save
88. send_email = True)
File "/.../lib/registration/models.py" in create_inactive_user
127. send_mail (subject, message, settings.DEFAULT_FROM_EMAIL, [new_user.email])
File "/usr/lib/python2.7/site-packages/django/core/mail/__init__.py" in send_mail
61. connection = connection) .send ()
File "/usr/lib/python2.7/site-packages/django/core/mail/message.py" in send
251. return self.get_connection (fail_silently) .send_messages ([self])
File "/usr/lib/python2.7/site-packages/django/core/mail/backends/smtp.py" in send_messages
79. new_conn_created = self.open ()
File "/usr/lib/python2.7/site-packages/django/core/mail/backends/smtp.py" in open
42. local_hostname = DNS_NAME.get_fqdn ())
File "/usr/lib64/python2.7/smtplib.py" in __init__
239. (code, msg) = self.connect (host, port)
File "/usr/lib64/python2.7/smtplib.py" in connect
295. self.sock = self._get_socket (host, port, self.timeout)
File "/usr/lib64/python2.7/smtplib.py" in _get_socket
273. return socket.create_connection ((port, host), timeout)
File "/usr/lib64/python2.7/socket.py" in create_connection
571. raise err
Exception Type: error at / accounts / register /
Exception Value: [Errno 13] Permission denied
source share