Giter Site home page Giter Site logo

Comments (13)

FedericoCeratto avatar FedericoCeratto commented on May 30, 2024

IIRC Gmail requires STARTTLS, can you try with:
"starttls://just-username:[email protected]:587" ?

from bottle-cork.

oshihirii avatar oshihirii commented on May 30, 2024

Result:

Browser: "Please check your mailbox".
MongoDB: User added to pending_registrations collection.
Email: No email sent to new user.

BUT:

Email was sent to secondary email address of sending email account (gmail) from google called:

"Suspicious sign in prevented"

With text:

"Someone recently used your password to try to sign in to your Google Account ****@gmail.com. This person was using an application such as an email client or mobile device.

We prevented the sign-in attempt in case this was a hijacker trying to access your account. Please review the details of the sign-in attempt:

Friday, November 15, 2013 7:13:25 AM UTC
IP Address: ... (ec2----.*****.amazonaws.com.)
Location: Chicago, IL, USA

If you do not recognize this sign-in attempt, someone else might be trying to access your account. You should sign in to your account and reset your password immediately".

from bottle-cork.

oshihirii avatar oshihirii commented on May 30, 2024

Update:

The troubleshooting steps in the email (ie https://support.google.com/mail/answer/14257) do not resolve the problem.

Another suggested solution (set up 'application specific passwords') is in the comments here:

http://stackoverflow.com/a/13732320/1063287

Gmail Account > Settings > Accounts > Other Google Account settings > Security > Connected applications and sites > Review permissions > Watch a video

However:

An application-specific password can only be created when you are signed up for 2-step verification.

(Interesting however that Fedora 19 GNOME access did not require 2-step verification sign up).

This requires using a code that will be sent to your phone, plus your regular password to access your email.

I am now looking for a less complex way of getting this working.

from bottle-cork.

FedericoCeratto avatar FedericoCeratto commented on May 30, 2024

This is how Google authentication works. You'll have to create an application-specific password once and then use it for sending email indefinitely.

from bottle-cork.

oshihirii avatar oshihirii commented on May 30, 2024

For reference:

After enabling 2-step authentication and creating an application-specific password for the web application, the user registration email is received.

from bottle-cork.

paperview avatar paperview commented on May 30, 2024

@oshihirii, @FedericoCeratto I have completed the 2-step authentication and am using the application specific password in this format: starttls://just-username:[email protected]:587

Did you use your gmail prefix for the username?

I keep getting this after 200 code but I never get 'Please check your inbox'

localhost - - [2014-12-19 23:47:55,015] Error sending email: [Errno 65] No route to host
Traceback (most recent call last):
  File "/Users/phil/Envs/stp/lib/python2.7/site-packages/cork/cork.py", line 847, in _send
    session = SMTP(self._conf['fqdn'])
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 250, in __init__
    (code, msg) = self.connect(host, port)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 310, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 285, in _get_socket
    return socket.create_connection((host, port), timeout)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 571, in create_connection
    raise err
error: [Errno 65] No route to host

from bottle-cork.

oshihirii avatar oshihirii commented on May 30, 2024

I searched the error and came across this, perhaps it will help in troubleshooting?

http://stackoverflow.com/questions/17708141/connecting-to-gmail-from-python

I'm working on application locally, but this is my code block that references starttls:

hostname = "mongodb://localhost:27017/"  
connection = pymongo.MongoClient(host=hostname)
mb = MongoDBBackend(db_name='users', initialize=True,hostname = hostname)
smtp_url = "starttls://username:[email protected]:587"
email_sender = "[email protected]"
aaa = Cork(backend=mb, email_sender=email_sender, smtp_url=smtp_url)

from bottle-cork.

paperview avatar paperview commented on May 30, 2024

@oshihirii thanks for the response, in case it is of interest @FedericoCeratto

I got it to work by changing a line in cork.py.

in def send_email(self, email_addr, subject, email_text):

i added some lines for debugging, but I think it's ~ line 847 - 849. I changed

session = SMTP(self._conf['fqdn'])

to

session = SMTP('%s:%s' % (self._conf['fqdn'], self._conf['port']))

and now it works!

from bottle-cork.

oshihirii avatar oshihirii commented on May 30, 2024

good to hear it works!

from bottle-cork.

FedericoCeratto avatar FedericoCeratto commented on May 30, 2024

@paperview: the SMTP() syntax is equivalent:

SMTP('smtp.gmail.com:587').ehlo() == SMTP('smtp.gmail.com', 587).ehlo() == SMTP(host=
smtp.gmail.com', port=587).ehlo() --> returns True, they are all working correctly

You probably had connectivity issues at the time. Can you reproduce the behavior you described?

from bottle-cork.

paperview avatar paperview commented on May 30, 2024

Hey @FedericoCeratto , thanks for the response. For me, the port wasn't included in the smtp call. The line read session = SMTP(self._conf['fqdn']) where self._conf['fdqn'] was 'smtp.gmail.com' and self._conf['port'] (not included in the call) was '587'. I'm not sure why the port parameter was missing in my cork.py. I don't recall removing it, but I've done crazier things.

from bottle-cork.

FedericoCeratto avatar FedericoCeratto commented on May 30, 2024

Ohh I get it, the code was updated after that, as part of #43

from bottle-cork.

paperview avatar paperview commented on May 30, 2024

I see, thank you. Just FYI if I use pip to get cork, I seem to still get the older version.

from bottle-cork.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.