Add line break when using notify gmail service (to better format email sent)

Hi All,

I am sending myself an end of day email with my energy costs using the notify gmail service. I would like to add a like break after the electricity costs but cant find any way to do this.

I believe this notify service sends in a plain text format so I dont think html tags will work.

If anyone can confirm if this is possible or not that would be great (and how would be amazing lol).

Code and output below.

Thanks very much Dan

Change this:

message: >-

To this:

message: |

See the interactive demo here: https://yaml-multiline.info/

Massive thanks for the quick reply. Had a good read and play with the interactive article. Sadly does not change the behaviour I am seeing in the email output. See updated pic.

Did you try \n as a line break ?

This works for me: {{- ā€˜\n’ -}}


    data_template:
      message: >-
        {{state_attr('sensor.detailed_forecast','detailedForecast')}} {{- '\n'
        -}} {{- '\n' -}} Tonight:
        {{state_attr('sensor.detailed_forecast1','detailedForecast')}} {{- '\n'
        -}} {{- '\n' -}} Tomorrow:
        {{state_attr('sensor.detailed_forecast2','detailedForecast')}}  
      title: Today's Weather

1 Like

Thanks for the reply - just tried this but not joy. Best guess its the gmail service that does like formatting. Are you sending email using a different service to gmail out of interest? Thanks again. Dan

I use the smtp gmail server


    platform: smtp
    server: smtp.gmail.com
    port: 587

Try just one line break


 {{- '\n' -}}

Thanks again - no joy sadly.

Think i will try setup the smtp gmail approach and see if that cracks it.

Thanks again

Try replacing ā€˜\n’ with ’ < br>'.

2 Likes

Incredible - this worked!

I have tried so many things and great to finally crack it,

Massive thanks !