SMTP Setup, Cant seem to get it to work

Hello,

Have been trying a number of config setups but haven’t been able to get SMTP working. I have a local Postfix server, so want to have a simple connection between HA SMTP and Postfix.

Here’s the config I have copied from the help page…

# Example configuration.yaml entry for Google Mail.
notify:
  - name: "NOTIFIER_NAME"
    platform: smtp
    server: "smtp.gmail.com"
    port: 587
    timeout: 15
    sender: "[email protected]"
    encryption: starttls
    username: "[email protected]"
    password: "YOUR_PASSWORD"
    recipient:
      - "[email protected]"
      - "[email protected]"
    sender_name: "SENDER_NAME"

My questions…

  • Has anyone managed to get HA SMTP to work with Postfix?
  • If the answer to above is yes, could you be so kind as to share your HA SMTP and Postfix config files i.e. the SMTP configuration.yaml and the Postfix /etc/postfix/main.cf and master.cf files.

I tried to start simple with the HA SMTP config… commenting out various options. See below…

# Example configuration.yaml entry for Google Mail.
notify:
  - name: "email_server"
    platform: smtp
    server: "<IP Address here>"
    port: 25
    timeout: 15
    sender: "[email protected]"
#    encryption: starttls
#    username: "[email protected]"
#    password: "YOUR_PASSWORD"
    recipient:
      - "[email protected]"
#      - "[email protected]"
    sender_name: "mr_sender"

But above didn’t work. So I figure there’s some things in the config that must be included… such as the username/password and probably the encryption.

I also tried connecting direct to my external email provider… here’s the config below.

notify:
  - name: "Email_Server"
    platform: smtp
    server: "mail.cheaperdomains.com.au"
    port: **465 or 995 (I tried both)**
    timeout: 15
    sender: "home.assistant@<mydomain>.com"
    encryption: none
    username: "<username>"
    password: "<password>"
    recipient:
      - "<recipient_email>"
    sender_name: "Home_Assistant"

But above doesn’t work either? So I figure the issue is likely the human factor… what might I be doing wrong?

The integration parameters will depend on the SMTP server parameters.

In the case of your local Postfix server, which port are you using? (25 is commonly for server relay and 587 for clients). Are you using TLS? What about authentication?

The same parameters must be determined for your email provider. Check with them what their settings for SMTP clients are.

HA logs may point you to what’s failing.

As an example… see below my NodeRed SMTP setup. Very simple and works really well talking to the PostFix server.

I am working on updating the Postfix server to require logins, but that is a work in progress. Would be awesome if I could get the HA SMTP config to be as simple as NodeRed config above, but it appears HA requires more config parameters.

I am also open to moving away from Postfix to another SMTP server/forwarder solution, assuming someone reading this might have a suggestion.

Ok, that config couldn’t be simpler. No authentication or encryption. HA should work with the first snippet you posted above. Check the HA and the SMTP server logs. Maybe after trying again with the debug parameter set to true.

Add the verify_ssl: false

‘’’
notify:

  • name: “Email_Server”
    platform: smtp
    server: “mail.cheaperdomains.com.au”
    port: 465 or 995 (I tried both)
    timeout: 15
    sender: “[email protected]
    encryption: none
    username: “”
    password: “”
    recipient:
    • “<recipient_email>”
      sender_name: “Home_Assistant”
      verify_ssl: false
      ‘’’
1 Like

The config below appears to have fixed the issue, allowing a connection to the Postfix box.

notify:
  - name: "email_server"
    platform: smtp
    server: "192.168.0.26"
    port: 25
    timeout: 15
    sender: "ha@<domain>.com"
    encryption: none
    username: ""
    password: ""
    recipient: "test@<domain>.com"
    sender_name: "Home Assistant"
    verify_ssl: false

Thanks to everyone for the help. Much appreciated.

1 Like