Email Alerts Not Working

Hi Kyle,

I have been trying to get email alerts sending in my conditional statements. The best I have been able to get is to receive the test email. I have used a Gmail account with the “less secure app access” turned on for both the sending and receiving addresses. Since attempting to try protocols other than SSL, I have not been able to receive even the test email.

My conditional scripts run all other actions except email alerts and I am sure I have used the correct password. Please could you point me where to look to solve the issue?

port: 465
protocol: SSL


2021-08-16 15:20:54,746 - ERROR - mycodo.outputs.on_off_gpio_835c6bbd - Status check error: None
2021-08-16 15:20:54,748 - INFO - mycodo.function.bang_bang_on_off_6d2127aa - Input: 24.0, output_raise: None, output_lower: None, target: 24.0, hyst: 2.0
2021-08-16 15:20:57,696 - ERROR - mycodo.notification - Could not send email to [’********’] with subject None
Traceback (most recent call last):
File “/var/mycodo-root/mycodo/utils/”, line 109, in send_email
server = smtplib.SMTP_SSL(smtp_host, port)
File “/usr/lib/python3.7/”, line 1031, in init
File “/usr/lib/python3.7/”, line 251, in init
(code, msg) = self.connect(host, port)
File “/usr/lib/python3.7/”, line 336, in connect
self.sock = self._get_socket(host, port, self.timeout)
File “/usr/lib/python3.7/”, line 1037, in _get_socket
File “/usr/lib/python3.7/”, line 707, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File “/usr/lib/python3.7/”, line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution
2021-08-16 15:20:59,806 - ERROR - mycodo.daemon - Could not query output state: None
Traceback (most recent call last):
File “/var/mycodo-root/mycodo/”, line 849, in output_state
return self.controller[‘Output’].output_state(output_id, output_channel)
File “/var/mycodo-root/mycodo/controllers/”, line 320, in output_state
return self.output[output_id].output_state(output_channel)
KeyError: None


It appears you’re having a DNS issue.

Can you reliably induce the issue or is it sporadic? If you can reproduce it, please share the steps. If its sporadic, it may be your networking causing the issue.

Okay so to my knowledge it seems to not work when behind a proxy. In order to access my university wifi (eduroam) from the Pi I need to use a mobile no root tethering application that requires working with a proxy. The email works and is sent when I connect to a different wifi/mobile network that does not need a proxy. Do you know of any work arounds?

I’ve never experienced that issue and don’t have any experience with working around that limitation. Perhaps you can use some sort of Python module to send a slack or discord message instead of email to alert you. I’ve been meaning to add a few more notification Action options like slack, discord, etc.

Okay, so I am able to send a discord message with the following python script when running it from command line:

import requests
from discord import Webhook, RequestsWebhookAdapter

webhook = Webhook.from_url("url-here", adapter=RequestsWebhookAdapter())

But when I incorporate the code into my conditional function it again seems caught up when using a proxy. I see there is a “webhooks” action but I do not quite understand how to set that up from the instructions given. I cannot see an example on the GitHub page - do you have one?

I feel like I am missing a simple way to execute a python script from a mycode function/output (I tried the python on/off output but it would not activate).

Take a look at this thread from the old forum discussing the webhook Action:

And subsequent pull request: