simonseyer / ZUKS-Website

The official ZUKS Website
http://www.zuks.org
GNU General Public License v3.0
0 stars 1 forks source link

Feedback if newsletter subscription failed is not shown #3

Closed monofox closed 9 years ago

monofox commented 9 years ago

If the mail server is down and you want to make a subscription on the newsletter you get the following error:

Traceback (most recent call last): File "/home/mono/.projects/zuks/zuks-django/core/views.py", line 69, in subscribeToNewsletter mail.sendMail('info@zuks.org', [recp], text, 'ZUKS Newsletter Registrierung', display_unsubscribe=False) File "/home/mono/.projects/zuks/zuks-django/core/mail.py", line 34, in sendMail send_mail(subject, text, sender, [receiver.email], html_message=html) File "/usr/lib64/python3.3/site-packages/django/core/mail/init.py", line 62, in send_mail return mail.send() File "/usr/lib64/python3.3/site-packages/django/core/mail/message.py", line 283, in send return self.get_connection(fail_silently).send_messages([self]) File "/usr/lib64/python3.3/site-packages/django/core/mail/backends/smtp.py", line 92, in send_messages new_conn_created = self.open() File "/usr/lib64/python3.3/site-packages/django/core/mail/backends/smtp.py", line 50, in open self.connection = connection_class(self.host, self.port, connection_params) File "/usr/lib64/python3.3/smtplib.py", line 241, in init** (code, msg) = self.connect(host, port) File "/usr/lib64/python3.3/smtplib.py", line 320, in connect self.sock = self._get_socket(host, port, self.timeout) File "/usr/lib64/python3.3/smtplib.py", line 291, in _get_socket self.source_address) File "/usr/lib64/python3.3/socket.py", line 435, in create_connection raise err File "/usr/lib64/python3.3/socket.py", line 426, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused

So that was the first issue: the case is not catched. If you have multiple receiver in "sendMail" method it could be that he stops trying to send the remaining recipients.

2.) You get this message back from server (i wonder that it worked till here):

    <input type='hidden' name='csrfmiddlewaretoken' value='glsrDuu9ncUjgWJG3G0V3uxLZoriVPP6' />
<div class="error">
    Die Anfrage konnte leider nicht bearbeitet werden. Versuche es später erneut.
</div>

</form>

But this is not shown on the site. So there is no visual or textual feedback.

simonseyer commented 9 years ago

See PR #6

monofox commented 9 years ago

Fixed with your PR #6