pyprind icon indicating copy to clipboard operation
pyprind copied to clipboard

Task Complete Email

Open DevMoore94 opened this issue 10 years ago • 15 comments

I figured I would open an issue to discuss possible solutions to the email notification. User privacy is important and it appears the available solutions could be pretty limited. So as far as privacy, we shouldn't be able to tell who and where an email is being sent correct?

DevMoore94 avatar Oct 30 '14 11:10 DevMoore94

Thanks for open a separate issue; it makes it simpler to keep the discussions organized! I think it should be some solution where we don't collect the email addresses of the users or information about their tasks. It sound a little bit cumbersome this way... But I think of being a user myself: I wouldn't feel comfortable if someone would be able to collect my user data e.g., when I ran certain task (especially if it is some work related stuff and a user wants to use descriptive labels). Honestly, I have no real idea if there are some libraries where something like that has already been implemented. But I'd be happy to do some research on that (some time after Nov 13 -- have some very important deadlines on this day I have to focus on right now)

rasbt avatar Oct 31 '14 03:10 rasbt

And if it is not so easily doable (sorry, I haven't thought about the privacy issue initially when I had this idea) don't worry about implementing an email feature for now; it was just an idea and it is not really so important! And thanks for your general interest in improving PyPrind, I really appreciate it

rasbt avatar Oct 31 '14 04:10 rasbt

No Problem at all! Just happy to be part of the project.

DevMoore94 avatar Oct 31 '14 13:10 DevMoore94

I just saw an article that might be very helpful for achieving this task:

Sending Email using Python http://trevorappleton.blogspot.co.uk/2014/11/sending-email-using-python.html

So, instead of providing the email in the ProgBar initialization, we can prompt for a configuration file, e.g., ProgBar(email_config='path_to_config_file')

Where the config file contains something like

SMTP_SERVER = 'smtp.gmail.com'
SMTP_PORT = 587
USERNAME = '[email protected]'
PASSWORD = 'your_gmail_password' 

However, we have to think about how to store the password. It should be at least encrypted somehow, otherwise it is really too dangerous to save the password somewhere in plain text on your computer

The only question would be how

rasbt avatar Nov 01 '14 20:11 rasbt

Encryption probably wouldn't be too bad. My. Concern is that sending an email to yourself through Gmail smtp limits this to only people with a Gmail account would it not?

DevMoore94 avatar Nov 01 '14 22:11 DevMoore94

Hey, Brandon, this was just an example, I assume that it works with most email providers. E.g., I just tested my icloud address (with smtp.mail.me.com) and it worked too. However, I couldn't get it to work with my edu address yet. I assume that it is a little bit tricky and requires some more testing.

I have to read more about the differences between ports, SSL, TLS, and STARTTLS. But I think that we can build something that tries to send the email first via e.g., the method that is posted in the blog article and if it raises an exception, we can try those SSL or TLS things.

rasbt avatar Nov 02 '14 23:11 rasbt

Wouldn't this require setting up servers for each different email provider?

DevMoore94 avatar Nov 03 '14 14:11 DevMoore94

Right, but I think this is all something that can go in a separate config file that a user needs to setup one time like I posted above:

SMTP_SERVER = 'smtp.gmail.com'
SMTP_PORT = 587
USERNAME = '[email protected]'
PASSWORD = 'your_gmail_password' 

I just had the thought, what about a separate function in PyPrind, e.g, pyprind.setup_email(...) that the user only has to run once (unless he wants to change settings) to setup such a config file? PyPrind would then generate an encrypted file with this information maybe in its own module directory so that every time in future when a user wants to receive an email conformation, he/she can initialize the ProgBar like pyprind.ProgBar(..., email=True) -- and if it can't find the config file it will print a warning message with instructions for the user.

rasbt avatar Nov 04 '14 05:11 rasbt

That sounds like a great idea! Seems to be the most logical solutions to the problem when factoring in privacy.

DevMoore94 avatar Nov 04 '14 12:11 DevMoore94

Agree:) I think it is not only privacy but also security! I would feel very uncomfortable if I would have to store my password in plain text somewhere on my computer. Also, if I would picture myself as a user who is using someone else's tool to send "job completion" notifications, I would feel more comfortable if it is kind of anonymous.

I just stumbled across an article in a weekly Python newsletter that I thought might be relevant for encryption: "ENCRYPTING FILES WITH PYCRYPTO" http://brainacle.com/encrypting-files-with-pycrypto.html

rasbt avatar Nov 07 '14 23:11 rasbt

I will have a look at this article and see if I can pull some ideas together. :)

DevMoore94 avatar Nov 10 '14 03:11 DevMoore94

Still not entirely sure how I would want to go about doing this.

DevMoore94 avatar Dec 03 '14 13:12 DevMoore94

Hey Sorry It's been a long time haha. Is this still a feature that would be useful to have?

DevMoore94 avatar Feb 17 '16 01:02 DevMoore94

@DevMoore94 No worries! Personally, I would find such a feature very useful for certain applications. The approach using smtplib (see the link to the post above) sounds pretty reasonable to me; I haven't tested it yet, though.

rasbt avatar Feb 18 '16 22:02 rasbt

@rasbt Hey, I read your thought about email notifications and created a pull request, I will be very please for your comments about it, this is my first open source experience, please don't be too harsh :)

dzaytsev91 avatar Sep 02 '16 10:09 dzaytsev91