kootenpv / yagmail

Send email in Python conveniently for gmail using yagmail
MIT License
2.66k stars 265 forks source link

always prompts for keyring password on Ubuntu #16

Closed loraxman closed 7 years ago

loraxman commented 9 years ago

After registering the user and email, it prompts everytime for the encrypted keyring password. yag = yagmail.SMTP() Please enter password for encrypted keyring:

Works fine on Mac Os

kootenpv commented 9 years ago

I'll test this on a Ubuntu VM and let you know. Thanks for filing!

kootenpv commented 9 years ago

Using Python 3.4 and Ubuntu 14.10, I can not reproduce.

What could be the thing is that perhaps you are not consistent with what you've saved? A username (e.g. kootenpv) would be stored differently as an emailaddress (e.g. kootenpv@gmail.com). Both can be used to login (if missing @..., it will add @gmail.com).

However, if you've saved it in one style, it does not work for the other. Could that be the case?

Let me know if there is anything else that you could think that has to do with it.

murtraja commented 8 years ago

i too have this issue! steps to reproduce

  1. go to pythonanywhere.com
  2. create an account
  3. open bash
  4. pip install --user keyrings.alt yagmail
  5. python
  6. import yagmail
  7. yagmail.register("user","pass")
  8. set keyring password here
  9. now create .yagmail file and test with SMTP
  10. it asks for keyring password EVERY time
kootenpv commented 8 years ago

.yagmail file should be in $HOME directory. Is it? Make sure that the .yagmail file just contains the username.

kootenpv commented 8 years ago

Let me know if you'd like me to add a "do you want to save a .yagmail file?" after the question whether or not to save in keyring.

murtraja commented 8 years ago

yagmail_prob

do i need to give a terminating end line in the yagfile?

kootenpv commented 8 years ago

No need for it. Make sure the username of gmail is in .yagmail, not the username on the PC. Hopefully that helps.

kootenpv commented 8 years ago

You can actually test by using "yagmail" command on the command line to see if it worked (if it works, no prompt, and it should send an email to yourself without subject and without contents)

murtraja commented 8 years ago

yagmail_prob_yagmail_command

murtraja commented 8 years ago

it turns out that the username of PC and gmail are the same!

kootenpv commented 8 years ago

So did it work in the end?

GeorgHo commented 8 years ago

Hello, I have the same problem on a Debian system (Raspberry Pi). He always asks for a Keyring Key to decrypt the Keyring file where the password is stored in. I have installed the keyrings.alt backend. I have not found a solution to store this password, so that it is dragged automatically.

kootenpv commented 8 years ago

@GeorgHo Perhaps it could work to just put the password in the script in that occasion then?

GeorgHo commented 8 years ago

Hi kootenpv, I solved the problem by entered the login data in the script. Now everything works fine!

kootenpv commented 8 years ago

@GeorgHo Great to hear, good luck!

murtraja commented 8 years ago

@GeorgHo even i did the same to make it work, but it defeats the purpose of securing your username and password. anyone who can view your script can see your username => you can't share your script!

kootenpv commented 8 years ago

@murtraja I'm thinking OAuth2 is the only way to solve running the script in an automated way without having to use keyring or password in script, and without compromising security. What do you think?

murtraja commented 8 years ago

The only reason I am using yagmail is because it DOES NOT use Oauth2. Reason being it screws up my automation email sending sometimes.!. That said, if you have already decided, try not to replace, make it like add on. Thanks On 5 Mar 2016 15:39, "Pascal van Kooten" notifications@github.com wrote:

@murtraja https://github.com/murtraja I'm thinking OAuth2 is the only way to solve running the script in an automated way without having to use keyring or password in script, and without compromising security. What do you think?

— Reply to this email directly or view it on GitHub https://github.com/kootenpv/yagmail/issues/16#issuecomment-192616138.

Jokerbullot commented 8 years ago

I do have the same issue on Debian (Raspberry Pi). I do have a .yagmail file in my home with just my gmail login (without @gmail.com)

when running python3 test_mail.py it asks me the keyring pwd and then succesfully send the email.

I tried adding or removing my login in the yagmail.SMTP() call but it does not change anything.

Any1 found a way to solve this ?

Tyvm all.

kootenpv commented 7 years ago

Oauth2 support has been added as of https://github.com/kootenpv/yagmail/commit/22cb687adc67fd9b16f870e5e658a3fa77ca67ac

This should be the way forward.