Ok this was definitely the problem. For posterity I'll post the full 
explanation here.

It turns out if you use 2-factor authentication with gmail, you need to 
follow the link thrown by the error (
https://support.google.com/accounts/answer/185833) which will then allow 
you to log into Google and create an application password. Generate a 
password, and then replace your normal password with the generated 
password. Drop back into shell (python manage.py shell) and try sending an 
email. It should work this time. 

Thank you to Eduardo and Danny for helping me out! It was an easy fix but 
not sure it had been documented before. 



On Saturday, December 5, 2015 at 12:31:25 PM UTC-6, Sarah Hein wrote:
>
> Ok I checked my "Sent" folder and there was definitely not an email sent 
> from the website. I tried sending an email from the shell as suggested (why 
> didn't I think of that?) and this is what I got:
>
>
>
> In [1]: from django.core.mail import send_mail
>
> In [2]: send_mail('Test from Django', 'This was a shell email', '
> [email protected]', ['[email protected]', '[email protected]'])
> ---------------------------------------------------------------------------
> SMTPAuthenticationError                   Traceback (most recent call last)
> <ipython-input-2-986af99f4ea4> in <module>()
> ----> 1 send_mail('Test from Django', 'This was a shell email', '
> [email protected]', ['[email protected]', '[email protected]'])
>
> C:\Python34\lib\site-packages\django\core\mail\__init__.py in 
> send_mail(subject, message, from_email, recipient_list, fail_silently, 
> auth_user, auth_password, connection, html_message)
>      60         mail.attach_alternative(html_message, 'text/html')
>      61
> ---> 62     return mail.send()
>      63
>      64
>
> C:\Python34\lib\site-packages\django\core\mail\message.py in send(self, 
> fail_silently)
>     301             # send to.
>     302             return 0
> --> 303         return 
> self.get_connection(fail_silently).send_messages([self])
>     304
>     305     def attach(self, filename=None, content=None, mimetype=None):
>
> C:\Python34\lib\site-packages\django\core\mail\backends\smtp.py in 
> send_messages(self, email_messages)
>      98             return
>      99         with self._lock:
> --> 100             new_conn_created = self.open()
>     101             if not self.connection:
>     102                 # We failed silently on open().
>
> C:\Python34\lib\site-packages\django\core\mail\backends\smtp.py in 
> open(self)
>      65                 self.connection.ehlo()
>      66             if self.username and self.password:
> ---> 67                 self.connection.login(self.username, self.password)
>      68             return True
>      69         except smtplib.SMTPException:
>
> C:\Python34\lib\smtplib.py in login(self, user, password)
>     650
>     651         # We could not login sucessfully. Return result of last 
> attempt.
> --> 652         raise SMTPAuthenticationError(code, resp)
>     653
>     654     def starttls(self, keyfile=None, certfile=None, context=None):
>
> SMTPAuthenticationError: (534, b'5.7.9 Application-specific password 
> required. Learn more at\n5.7.9  
> https://support.google.com/accounts/answer/185833 iq6sm8291294obb.0 - 
> gsmtp')
>
>
> It looks like you're right and the Gmail authentication was not working, 
> but Mezzanine swallowed the error on the live website. I don't know if 
> Google has updated their interface for email clients, but I'll see if I 
> can't get it sorted and then report back. Thank you for setting me on the 
> right track!
>
>
> On Friday, December 4, 2015 at 10:54:51 AM UTC-6, Eduardo Rivas wrote:
>>
>> Can you try sending an email from the Django shell? Mezzanine is most 
>> likely swallowing the mail error to avoid raising a 500. 
>>
>> https://docs.djangoproject.com/en/1.8/topics/email/#send-mail 
>>
>> Just fill the three first params. It'll try to send the email, if 
>> everything goes well, it'll return nothing. Else, you should get a 
>> traceback. 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to