SMTP setup not still not working using Google SMTP server

Hello! I am new to HA. I’m trying to setup SMTP to be able to send text alert to my phone. I have followed the instructions in HA (SMTP - Home Assistant). There is an error in that example (sender_name: is wrong! it should be just sender:). Anyway I use Google and Google needs an App Password so I created an App Password in Google so I can use it in conjunction with my SMTP setup. However, I still get an error when HA tries to connect to the Google SMTP server.

smtplib.SMTPAuthenticationError: (534, b’5.7.9 Application-specific password required. Learn more at\n5.7.9 Sign in with App Passwords - Google Account Help cm8-20020a056830650800b00636ed80eab8sm530290otb.4 - gsmtp’)
2022-08-12 12:53:48.497 ERROR (MainThread) [homeassistant.components.notify] Failed to initialize notification service smtp

The error is pointing to the use of Application-specific password, which I’m already using. Here’s my Config:

notify:
 - platform: smtp
    name: send_text
    server: smtp.gmail.com
    port: 587
    encryption: starttls
    username: !secret gmail_address
    password: !secret gmail_password
    sender: !secret gmail_address
    recipient: !secret recipient_address

And here’s my code in the automations.yaml:

- service: notify.send_text
   data:
     message: Internet is down!!
     title: Internet Status

Have you tried doing an SMTP setup with say a simple email client? That error looks to be a Google error. Google is trying to completely do away with password-based email authentication. If you can confirm that you can use the same configuration you are trying to use on HA with something like the Thunderbird email client then you will know for sure if this is a Google/Gmail Account configuration issue or a HA configuration issue.

Oh! I think my text went through the Gmail SMTP server! I opened my “Sent” folder in GMail and the text message was sent. Although, the mobile carrier of my iPhone hasn’t delivered it to me!

I think this is a step forward to my project of being able to text me whenever there is an important event in my Home Assistant.

There you go. Also another thing to be clear on with the SMTP configuration is that there is a difference between sender & sender_name those are two different configuration items. The sender is the email address and the sender_name is the name you want to go along with the email address.

Aha! Thanks for clarifying sender and sender_name.

Moderator: Please consider this closed. Thank you.

I have successfully fixed my Configuration and Automation files and my text alerts are working. However I’d like to make an RFC: make multiple recipients in the smtp directive in the configuration.yaml (example below), instead of creating multiple name1/recipient1 then name2/recipient2, etc…

notify:
  - name: send_yahoo_text
    platform: smtp
    server: smtp.mail.yahoo.com
    port: 587
    encryption: starttls
    username: !secret yahoo_username
    password: !secret yahoo_password
    sender: !secret yahoo_address1
    recipient: !secret yahoo_address2
    recipient: !secret yahoo_address3
    recipient: !secret yahoo_address4

@crc111 multiple recipients is already supported it’s in the documentation you linked to. Example:

recipient:
      - "[email protected]"
      - "[email protected]"

Really??? I think I tried this but I got Configuration error! I have to re-visit this section of my config. Thanks.

Yes, I now have multiple recipient addresses under ONE recipient line. Thank you.

I know this is an old thread, and this is a noob question, but I am struggling to get the SMTP integration to work and one key point of confusion is the use of quotes. I see in the SMTP setup examples quotes are used, but I see many posts with quotes omitted. My integration is not working consistently with or without, but knowing whether quotes are required would at least eliminate that as a potential issue. So are quotes required as shown in the doc, and if I use a secret for my password, I assume in that case all I need is the reference to the password entry (e.g. !secret foobar vs. “!secret foobar”)?

Did you get this working? Did you confirm that the settings you were trying would work outside of HA, like with a regular SMTP client?

I did get it working. Someone on the integration page told me the quotes were optional. I think I omitted them, but at any rate I did eventually get it working. Thanks!

I’m having the same issue. Could you let us know how you finally got it working?
Thank you!

Here is my actual config entry (email changed):

  notify:
    - name: gmail
      platform: smtp
      server: "smtp.gmail.com"
      port: 587
      sender: "[email protected]"
      encryption: starttls
      username: "[email protected]"
      password: !secret google_app_password
      recipient:
        - "[email protected]"
        - "[email protected]"

One point of confusion for me was the Google password, which in my secrets file includes its spaces and is NOT enclosed in quotes.