Re: [mezzanine-users] Email from forms...

2015-12-05 Thread Sarah Hein
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', 
'myem...@gmail.com', ['workem...@institution.com', 'myem...@gmail.com'])
---
SMTPAuthenticationError   Traceback (most recent call last)
 in ()
> 1 send_mail('Test from Django', 'This was a shell 
email', 'myem...@gmail.com', ['workem...@institution.com', 
'myem...@gmail.com'])

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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Email from forms...

2015-12-05 Thread Sarah Hein
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', '
> myem...@gmail.com', ['workem...@institution.com', 'myem...@gmail.com'])
> ---
> SMTPAuthenticationError   Traceback (most recent call last)
>  in ()
> > 1 send_mail('Test from Django', 'This was a shell email', '
> myem...@gmail.com', ['workem...@institution.com', 'myem...@gmail.com'])
>
> 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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Email from forms...

2015-12-04 Thread Eduardo Rivas
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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] Email from forms...

2015-12-04 Thread Sarah Hein
I feel silly, but I swear I've tried to fix this on my own and by checking 
the docs...

Working to deploy Mezzanine with Python 3.4 onto a Digital Ocean VPS. 
Trying to mimic the Fabric deploy the best I can, and have it set up with 
PostgresQL, Supervisord, Nginx, and Gunicorn. Everything seems to be 
working as expected so far.

The only hiccup is that I can't get the form to automatically send me 
emails. I've filled in the various settings via the admin panel, and I've 
added the following to settings.py (following Ross Laird's excellent guide 
):

##
# SEND EMAIL #
##
# enable email via gmail
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'sarah.is.a.super.common.n...@gmail.com'
EMAIL_HOST_PASSWORD = 'passwordsarefun'
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'sarah.is.a.super.common.n...@gmail.com'


Prior to changing all of these settings, I would get an error message when 
I tried to use the form to send an email. Now I get a success message 
following form submission, and I can see the entries under "View Entries" 
from the admin panel. I just never get an email. I don't get it. Is Google 
blocking me? Is there another program I was supposed to have installed and 
integrated? I feel bad clogging up the mailing list, as I bet it's 
something simple I'm missing, but I'm out of ideas on how to fix this.

-- 
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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Email from forms...

2015-12-04 Thread Danny

On 5/12/2015 3:19 AM, Sarah Hein wrote:
I feel silly, but I swear I've tried to fix this on my own and by 
checking the docs...


Working to deploy Mezzanine with Python 3.4 onto a Digital Ocean VPS. 
Trying to mimic the Fabric deploy the best I can, and have it set up 
with PostgresQL, Supervisord, Nginx, and Gunicorn. Everything seems to 
be working as expected so far.


The only hiccup is that I can't get the form to automatically send me 
emails. I've filled in the various settings via the admin panel, and 
I've added the following to settings.py (following Ross 
Laird'sexcellent guide 
):


|
##
# SEND EMAIL #
##
# enable email via gmail
EMAIL_HOST ='smtp.gmail.com'
EMAIL_PORT =587
EMAIL_HOST_USER ='sarah.is.a.super.common.n...@gmail.com'
EMAIL_HOST_PASSWORD ='passwordsarefun'
EMAIL_USE_TLS =True
DEFAULT_FROM_EMAIL ='sarah.is.a.super.common.n...@gmail.com'
|


Prior to changing all of these settings, I would get an error message 
when I tried to use the form to send an email. Now I get a success 
message following form submission, and I can see the entries under 
"View Entries" from the admin panel. I just never get an email. I 
don't get it. Is Google blocking me? Is there another program I was 
supposed to have installed and integrated? I feel bad clogging up the 
mailing list, as I bet it's something simple I'm missing, but I'm out 
of ideas on how to fix this.


Given that the email is *from* you and *to* you, check your Gmail "All 
Mail" or "Sent Mail" folder, just to ensure it's not being automatically 
filed there, rather than in your inbox.


Seeya. Danny.

--
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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.