OctoPrint-EmailNotifier
OctoPrint-EmailNotifier copied to clipboard
validate_email ERROR - On Test Email Send
I have attempted to get this plug in setup, but even once I installed keyring and yagmail I get: "sending failed. Reason :: send() got an unexpected keyword argument "validate_email".
This makes it seem like by default octoprint doesn't come with the pip package validate_email installed, but I went ahead and installed it as well and still get that error.
EDIT: btw if I do a test send just from the python console using yagmail.SMTP().send() it works fine.
Take a look at my pull request -- it appears that yagmail was recently changed and removed the validate_email parameter from the send method. The plugin is trying to reference that parameter in the send method, but it no longer exists. If you remove that parameter (it was set to False anyway) you can get the plugin to work.
@jeffgolden : Great response time, and yep that fixed the issue. Don't you love it when APIs change and mess up your code base! Thanks alot for the quick fix, and hopefully your pull is approved soon to keep others from dealing with this.
NOTE: I will leave the issue open until the pull is accepted (or is closed by the repo owner)
Just to be clear, I modified the file __ init __.py found in /home/pi/oprint/lib/python2.7/site-packages/octoprint_emailnotifier and changed the line:
mailer.send(to=emails, subject=subject, contents=body, validate_email=False)
to
mailer.send(to=emails, subject=subject, contents=body)
Just in case someone else is looking for more direct instructions. You have to restart Octoprint for the changes to take affect.
@DrWatson Thanks for your post, got me up and running!
@ItsMrChops Hey there, I can't for the life of me locate the init.py file in /home/pi/oprint/lib/python2.7/site-packages/octoprint_emailnotifier
what did you type in while connected via ssh to get to that file?
i'm also getting the "Sending failed. Reason:: send() got an unexpected keyword argument 'validate_email' " error.
Thanks!
I'm a Windows user and know next to nothing about Linux but found I could use Notepad++ and it's NppFTP plugin to connect with SFTP. It has a directory browser and editing files is really easy. I think the .py file name starts with _ maybe. Hope this helps.
@ItsMrChops oh wow, somehow i never thought to sftp into my pi to see the directory browser, I've been doing everything in the terminal the entire time! I've connected through sftp and made the change! I just need to wait for the print to finish up before I restart octoprint. Thank you for the tremendous tip!
This is the path for me:
~/OctoPrint/venv/lib/python2.7/site-packages/octoprint_emailnotifier
This was the location for me: ~/oprint/lib/python2.7/site-packages/octoprint_emailnotifier
mailer.send(to=emails, subject=subject, contents=body)
Now I am getting this message: Sending failed. Reason:: Emailaddress "" is not valid according to RFC 2822 standards
Any ideas? Thanks
Update I tried sending an email through python and it worked but I had to import yagmail again. Then I tried again in OctoPrint and was successful. Do I have to import yagmail on every restart?
I had the " is not valid according to RFC 2822 standards" error when I was using it too. All I needed to do was save the settings and reopen the configuration for notifier and hit test again and it worked. I think it's just not picking up the live value from the control so saving it and reloading the configuration fixes it.
Is this still an open issue? I was able to get it to work under 0.15.1 with only adding one more line to the yagmail setup...