G+_Rud Dog Posted February 3, 2016 Share Posted February 3, 2016 Looking for an existing python 3 script running on windows 8 which allows sending emails to my gmail account. Do not want to lower my security level so it must incorporate Oauth2. Link to comment Share on other sites More sharing options...
G+_Jeff Brand Posted February 3, 2016 Share Posted February 3, 2016 A script that uses SMTP can deliver the message directly to Gmail's SMTP server, removing the need for authentication. Not sure which security level you mean (UAC or generally speaking) which might affect the answer. Link to comment Share on other sites More sharing options...
G+_Rud Dog Posted February 4, 2016 Author Share Posted February 4, 2016 Please show me an python example of what you mean in your response especially in the first paragraph. Link to comment Share on other sites More sharing options...
G+_Jason Marsh Posted February 4, 2016 Share Posted February 4, 2016 I couldn't code a blinky light, but is this any help? >>> http://bit.ly/1P9jNX7 Link to comment Share on other sites More sharing options...
G+_Rud Dog Posted February 5, 2016 Author Share Posted February 5, 2016 Reluctant to follow that link what is it? Link to comment Share on other sites More sharing options...
G+_Jeff Brand Posted February 5, 2016 Share Posted February 5, 2016 http://www.tutorialspoint.com/python/python_sending_email.htm Link to comment Share on other sites More sharing options...
G+_Jeff Brand Posted February 5, 2016 Share Posted February 5, 2016 Also, add a + to the end of any Bitly link for info about it: http://bit.ly/1P9jNX7+ Link to comment Share on other sites More sharing options...
G+_Rud Dog Posted February 5, 2016 Author Share Posted February 5, 2016 Apparently all scripts prior to google changing the access methodology will fail or better stated will allow you to lower secure level on google side to allow your script to function. With out knowing what the implications are for doing such a thing will continue to search for a secure way to send and receive email from google mail. Hint found since starting this research is they implemented Oauth2 which can't seem to figure out how to use this in a python 3 script. Link to comment Share on other sites More sharing options...
G+_Jeff Brand Posted February 5, 2016 Share Posted February 5, 2016 I'll try to be clearer: If you're trying to email your Gmail account, you don't need access to the Gmail API. You only need to send an email that doesn't get blocked as spam. This has less to do with Google's security model and more to do with Gmail being useless if people can't email you. My Linkstation NAS sends me a daily report by connecting through smtp.gmail.com port 465 via SMTP over SSL with authentication. It works. No need to provide OAuth credentials or anything besides standard email protocols. There may be a way to avoid authentication credentials by using port 25 (blocked by my ISP), my own ISP's SMTP services (they know I'm on their network, therefore not an open relay,) or create a throw-away Gmail account to avoid storage of your main account's credentials. By all means, pursue the Oauth angle if you prefer but it's not necessary. Short of Google deprecating SMTP as a valid email transit protocol, (not impossible...) my suggested method will continue to work without the need for such dependencies. Link to comment Share on other sites More sharing options...
G+_Rud Dog Posted February 5, 2016 Author Share Posted February 5, 2016 Two questions to you methond: "My Linkstation NAS sends me a daily report by connecting through smtp.gmail.com port 465 via SMTP over SSL with authentication. It works. No need to provide OAuth credentials or anything besides standard email protocols." If you could send me a copy of how your python script? Also have you changed any setting on the google side to lower secure level to get you script to run? Link to comment Share on other sites More sharing options...
G+_Jeff Brand Posted February 5, 2016 Share Posted February 5, 2016 It's not my python script, it's part of the admin reporting utilities. The script linked above in the bitly link shows how to send a simple SMTP message. I may have had to enable external clients so that I could connect via SMTP. You should be able to confirm that it works by configuring any email client (Thunderbird, any mobile platform's Mail app, Windows Live Mail) with your Gmail account's settings and sending yourself an email. Link to comment Share on other sites More sharing options...
G+_Rud Dog Posted February 5, 2016 Author Share Posted February 5, 2016 Copied and pasted adjusted for my application and it fails. Link to comment Share on other sites More sharing options...
G+_Jeff Brand Posted February 5, 2016 Share Posted February 5, 2016 Wait, new code didn't work the first time? Shocking! Oh, wait, no. That just describes my work day. Link to comment Share on other sites More sharing options...
Recommended Posts