How can i format message body of smtp?

I’d like to send a long message via smtp, how can I format the message into multiple lines? “\r\n” does not work.

Are you using the SMTP component? It should be trivial if you use HTML, and I suspect (but haven’t tried) that the same approach will work for the plain text body:

        message: >
          This is your multi-line message
          You just can't have a blank line

            - /home/pi/snapshot1.jpg
            - /home/pi/snapshot2.jpg

When using message: > the first blank line ends the message.

@Tinkerer. Are you able to send images like shown above using the SMTP component?

Sorry for the off topic.

I don’t use the SMTP component

Hi there,
I’m sending Mails with Image and HTML with this script:

      - service: notify.gmail_smtp
          title: 'DWD Wetterwarnung!'
          message: ' '
              - warnungen_gemeinde_map_bay.png
            html: >
                {{ states.sensor.dwd_html.state }}

The file sensor reads a text file where the whole HTML is in one line and is generated from a python script.

1 Like

how can I start new line in multiline message?? \n - does not work.

Also came here wondering how to insert a newline … \n or \\n etc?

update: I scoured around other threads and found that {{"\n"}} works for me. Example below will skip 2 lines.

  - service: notify.SMTP
      title: Alert!
      message: {{ trigger.to_state.attributes.friendly_name }} alarm {{"\n\n"}}details: