inventory-hunter
inventory-hunter copied to clipboard
email alerter failed to alert
discord alert works just fine, but email alerta in the same scraper does not work.
E2021-04-16 04:19:51,048 [root] email alerter failed to alert Traceback (most recent call last): File "/src/alerter/common.py", line 38, in call alerter(**kwargs) File "/src/alerter/emailer.py", line 53, in call with smtplib.SMTP(self.relay) as s: File "/usr/local/lib/python3.9/smtplib.py", line 255, in init (code, msg) = self.connect(host, port) File "/usr/local/lib/python3.9/smtplib.py", line 341, in connect self.sock = self._get_socket(host, port, self.timeout) File "/usr/local/lib/python3.9/smtplib.py", line 312, in _get_socket return socket.create_connection((host, port), timeout, File "/usr/local/lib/python3.9/socket.py", line 843, in create_connection raise err File "/usr/local/lib/python3.9/socket.py", line 831, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused
@EricJMarti Please look into this as email is totally broken atm.
I had this error and was able to fix it by doing a few things:
- Finding the local address change of the docker container(s) using ifconfig. In my case it was 172.18.0.0/16 and 172.17.0.0/16
- Adding those IP ranges (in that format) to /etc/postfix/main.cf, in the mynetworks line. That line now looks like: mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 172.18.0.0/16 172.17.0.0/16
- Restarting postfix with "sudo systemctl restart postfix"
- Running the container with the relay set as my local LAN IP for my Raspberry Pi, in my case 192.168.1.X
Doing those and launching a new container with those settings, I'm successfully sending email! Not sure why sendmail/postfix didn't want to accept mail on 127.0.0.1.