SMPT with & two factor authentication

hello everyone here’s how to configure the sending of SMTP mail with

configuration.yaml :

  - platform: smtp
    name: smtpmail
    port: 587
    timeout: 15
    sender: !secret notification_sender
    starttls: true
    username: !secret notification_username
    password: !secret notification_password
      - !secret notification_recipient
    sender_name: My Home Assistant

and in secrets.yaml

notification_sender: YOURMAIL
notification_username: YOURMAIL
notification_password: YOURPASSWORD
notification_recipient: YOURMAIL

To create a new app password for an app or device, take the following steps. You can repeat these steps to create an app password for as many apps or devices as you need.

  1. Go to the Security basics page and sign in to your Microsoft account.
  2. Select More security options .
  3. Under App passwords , select Create a new app password . A new app password is generated and appears on your screen.
  4. Enter this app password where you would enter your normal Microsoft account password in YOURPASSWORD.