Smtp via mail.ch

hey folks, need your help. is there something i’m missing?
user and password are correct, triple checked.

may anyone give me a hint, why my notify.mail_ch won’t work out of home assistant?

this does not work and gives me back an
SMTPException sending mail: retrying connection

Is there a difference between the notify and the python script?

Does NOT work:

notify:
  - name: mail_ch
    platform: smtp
    sender: "[email protected]"
    recipient: "[email protected]"
    server: "smtp.mail.ch"
    port: 587
    encryption: starttls
    user: "[email protected]"
    password: "mypassword"
    sender_name: "HomeAssistant"
    timeout: 60

this DOES work flawlessly (home assistant, terminal, python):

import smtplib
 
 smtp_server = "smtp.mail.ch"
 port = 587
 sender = "[email protected]"
 password = "mypassword"
 recipient = "[email protected]"
 
 subject = "test"
 body = "works"
 
 message = f"Subject: {subject}\n\n{body}"
 
 with smtplib.SMTP(smtp_server, port) as server:
...     server.starttls()
...     server.login(sender, password)
...     server.sendmail(sender, recipient, message)
... 
(220, b'2.0.0 Ready to start TLS')
(235, b'2.7.0 Authentication successful')

thanks
soendi

solved.

notify:
  - name: mail_ch
    platform: smtp
    sender: "[email protected]"
    recipient: "[email protected]"
    server: "smtp.mail.ch"
    port: 587
    encryption: starttls
    username: "[email protected]"
    password: "mypassword"
    sender_name: "HomeAssistant"
    timeout: 60

it needs to be ‘userNAME’ not only ‘user’.

soendi