Open bipsendk opened 7 years ago
It maybe a bit late to help with this particular problem, but it might help someone else in the future ...
I was stuck with the same issue recently where I tried to set up Email Notifier without authentication because we run our own email server locally and sending an email from a client will fail if we try to use any type of authentication.
In the end the solution which worked for us was;
__init__.py
which was located under
/home/pi/oprint/lib/python2.7/site-packages/octoprint_emailnotifier
mailer = yagmail.SMTP(user={self._settings.get(['mail_username']):self._settings.get(['mail_useralias'])}, host=self._settings.get(['mail_server']),port=self._settings.get(['mail_server_port']), smtp_starttls=self._settings.get(['mail_server_tls']), smtp_ssl=self._settings.get(['mail_server_ssl']))
mailer = yagmail.SMTP(user=self._settings.get(['mail_username']), password=None, host=self._settings.get(['mail_server']), port=self._settings.get(['mail_server_port']), smtp_skip_login=True, smtp_starttls=self._settings.get(['mail_server_tls']), smtp_ssl=self._settings.get(['mail_server_ssl']))
The key changes to the original line were;
Removed self._settings.get(['mail_useralias'])
(we didn't need the alias parameter)
Added password=None
(you still need a username for the "From" section of the email, but no P/W)
Added smtp_skip_login=True
(this was the big one!)
You can directly edit the existing line if you like, but I always like to keep the original code as a reference (particularly when testing) or just in case something goes wrong and you need to revert back.
Additionally, we also needed to add our desired username to a new file in the home directory which caused another error (because the yagmail was looking for this file, which was missing). The username is just used for the "From" section of the email sent, and in our case it didn't even need to be a valid user on our email system (update the "{ }" sections in the following to suit).
echo {Username}@{Email Address} > ~/.yagmail
I hope this helps!
OctoPrint Email Notifier Settings Example for No SMTP Authentication
It would be nice, if the plugin supported to use a standard SMTP server (that allows relaying) without having to enter user credentials.