usgo / online-ratings

AGA Online Ratings protocol and implementation
MIT License
23 stars 12 forks source link

SMTP Errors in Local Dev #66

Open artasparks opened 8 years ago

artasparks commented 8 years ago

I'm getting errors related to SMPT mailing in local dev. This happens any time I try to do a login/ registration.

@brilee -- does this happen for you too? Do we need to change the value of the following?

MAIL_SERVER=smtp_server.usgo.org

Full error example:

web_1       | Traceback (most recent call last):
web_1       |   File "/usr/local/lib/python3.4/site-packages/flask/app.py", line 1817, in wsgi_app
web_1       |     response = self.full_dispatch_request()
web_1       |   File "/usr/local/lib/python3.4/site-packages/flask/app.py", line 1477, in full_dispatch_request
web_1       |     rv = self.handle_user_exception(e)
web_1       |   File "/usr/local/lib/python3.4/site-packages/flask/app.py", line 1381, in handle_user_exception
web_1       |     reraise(exc_type, exc_value, tb)
web_1       |   File "/usr/local/lib/python3.4/site-packages/flask/_compat.py", line 33, in reraise
web_1       |     raise value
web_1       |   File "/usr/local/lib/python3.4/site-packages/flask/app.py", line 1475, in full_dispatch_request
web_1       |     rv = self.dispatch_request()
web_1       |   File "/usr/local/lib/python3.4/site-packages/flask/app.py", line 1461, in dispatch_request
web_1       |     return self.view_functions[rule.endpoint](**req.view_args)
web_1       |   File "/usr/local/lib/python3.4/site-packages/flask_security/decorators.py", line 205, in wrapper
web_1       |     return f(*args, **kwargs)
web_1       |   File "/usr/local/lib/python3.4/site-packages/flask_security/views.py", line 117, in register
web_1       |     user = register_user(**form.to_dict())
web_1       |   File "/usr/local/lib/python3.4/site-packages/flask_security/registerable.py", line 41, in register_user
web_1       |     user=user, confirmation_link=confirmation_link)
web_1       |   File "/usr/local/lib/python3.4/site-packages/flask_security/utils.py", line 333, in send_mail
web_1       |     mail.send(msg)
web_1       |   File "/usr/local/lib/python3.4/site-packages/flask_mail.py", line 491, in send
web_1       |     with self.connect() as connection:
web_1       |   File "/usr/local/lib/python3.4/site-packages/flask_mail.py", line 144, in __enter__
web_1       |     self.host = self.configure_host()
web_1       |   File "/usr/local/lib/python3.4/site-packages/flask_mail.py", line 158, in configure_host
web_1       |     host = smtplib.SMTP(self.mail.server, self.mail.port)
web_1       |   File "/usr/local/lib/python3.4/smtplib.py", line 242, in __init__
web_1       |     (code, msg) = self.connect(host, port)
web_1       |   File "/usr/local/lib/python3.4/smtplib.py", line 321, in connect
web_1       |     self.sock = self._get_socket(host, port, self.timeout)
web_1       |   File "/usr/local/lib/python3.4/smtplib.py", line 292, in _get_socket
web_1       |     self.source_address)
web_1       |   File "/usr/local/lib/python3.4/socket.py", line 498, in create_connection
web_1       |     for res in getaddrinfo(host, port, 0, SOCK_STREAM):
web_1       |   File "/usr/local/lib/python3.4/socket.py", line 537, in getaddrinfo
web_1       |     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
web_1       | socket.gaierror: [Errno -2] Name or service not known
brilee commented 8 years ago

The SMTP stuff has to be connected to a working account. The app sends an email to confirm that you've registered - that's probably the part that was throwing an error for you during registration. I should have made the placeholder email address more clear; in production that env value is set to Amazon SES, and locally I test using a throwaway gmail account.

I don't know enough about how email works to say if there's a sensible default localhost-ish configuration that would work out of th ebox.

vash3g commented 7 years ago

From Amazon SES account. Sending Quota: send 50000 emails per 24 hour period Max Send Rate: 14 emails/second

I think we can get away with using that for dev testing until everything is fine. If need be we can up that limit.