SMTP errors after configurtion

Hi Everyone!

I want to try and send an gmail email to myself as an automation.
As such i placed the following under the notify section at the configurtion.yml and checked the confugrtion which turned to be just fine.

name: sendemail
platform: smtp
server: smtp.gmail.com
port: 587
timeout: 15
sender: [email protected]
starttls: true
username: [email protected]
password: password
recipient:
- [email protected]
sender_name: Home Assistant

However after restarting HA to try the notify the following errors apeared at the HA logger:

2018-06-25 19:10:10 ERROR (MainThread) [homeassistant.components.notify] Error setting up platform smtp
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/notify/init.py”, line 95, in async_setup_platform
platform.get_service, hass, p_config, discovery_info)
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/notify/smtp.py”, line 75, in get_service
if mail_service.connection_is_valid():
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/notify/smtp.py”, line 120, in connection_is_valid
server = self.connect()
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/notify/smtp.py”, line 106, in connect
self._server, self._port, timeout=self._timeout)
File “/usr/local/lib/python3.6/smtplib.py”, line 251, in init
(code, msg) = self.connect(host, port)
File “/usr/local/lib/python3.6/smtplib.py”, line 336, in connect
self.sock = self._get_socket(host, port, self.timeout)
File “/usr/local/lib/python3.6/smtplib.py”, line 307, in _get_socket
self.source_address)
File “/usr/local/lib/python3.6/socket.py”, line 724, in create_connection
raise err
File “/usr/local/lib/python3.6/socket.py”, line 713, in create_connection
sock.connect(sa)
OSError: [Errno 99] Cannot assign requested address

Anyone has a clue what am i doing wrong or to debug and solve the problem?

Some Info

HA version: 0.72
Platform: HA on a RSP3

DNS:
nslookup smtp.gmail.com
Server: 8.8.4.4
Address: 8.8.4.4#53

Non-authoritative answer:
smtp.gmail.com canonical name = gmail-smtp-msa.l.google.com.
Name: gmail-smtp-msa.l.google.com
Address: 64.233.166.108
Name: gmail-smtp-msa.l.google.com
Address: 64.233.166.109

Thanks in advance for any suggestion!!!

Have you tried this (Option 2)? https://support.google.com/accounts/answer/6010255?hl=en

Hi Tom,

Thanks for taking the time trying to help!
I did verifed that the less secured apps option is on and unfortently it is set to on.
Any other suggestion?

What about changing the sender_name to a valid email address?

Or dropping the @gmail.com from the username.

I must admit I never had much luck with gmail’s smtp server when I tried using it to receive snapshots directly from my ip cameras.

I have used offcourse an valid email adress… just changed it here in the post so any robots searching for valid email adressses wont send me spam :slight_smile:
Ommting the @gmail part is not allowed according to HA .

Do you think it is autenticatation issue rather than missing package or configurtion?

This is not a bug!
For anyone else encontering problem with SMTP in my case it was related to the firewall.
After installing firestarter and stopping the firewall the problem seems to be gone.
Still needs to verify which port should be opened (587?)