OctoPrint-EmailNotifier icon indicating copy to clipboard operation
OctoPrint-EmailNotifier copied to clipboard

validate_email ERROR - On Test Email Send

Open MikeBrWade opened this issue 7 years ago • 11 comments

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.

MikeBrWade avatar Jul 06 '17 20:07 MikeBrWade

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 avatar Jul 06 '17 20:07 jeffgolden

@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)

MikeBrWade avatar Jul 06 '17 20:07 MikeBrWade

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 avatar Jul 17 '17 16:07 DrWatson

@DrWatson Thanks for your post, got me up and running!

ItsMrChops avatar Aug 21 '17 19:08 ItsMrChops

@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!

hammiesam avatar Aug 22 '17 06:08 hammiesam

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 avatar Aug 22 '17 08:08 ItsMrChops

@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!

hammiesam avatar Aug 22 '17 09:08 hammiesam

This is the path for me:

~/OctoPrint/venv/lib/python2.7/site-packages/octoprint_emailnotifier

ManuGithubSteam avatar Sep 04 '17 09:09 ManuGithubSteam

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?

thauch avatar Sep 08 '17 09:09 thauch

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.

DrWatson avatar Sep 08 '17 20:09 DrWatson

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...

Stady234 avatar Jun 18 '18 22:06 Stady234