Home > Back-end >  Adding line break inside firebase email trigger copy using Reactjs
Adding line break inside firebase email trigger copy using Reactjs

Time:02-05

Can't seem to figure out why my line breaks aren't working. Any help would be greatly appreciated. I'm using the firebase Email Trigger extension to send a registration confirmation email. I want to add multiple lines to the text, but the line breaks won't carry over once the email has been delivered. Inside my firebase function I have the following:

to: email,
        message: {
            subject: "Thanks you for registering!",
            html: `
  Hey ${firstName || ""}!
  
  We wanted to take a moment to thank you for signing up with us. We are thrilled to have you on board and can't wait to help you achieve your Real Estate Wholesaling and Investing goals.
  
  We are dedicated to providing the best Wholesaling tools to help you succeed. If you have any questions or need assistance, our team is always here to help.
  
  Thank you again for choosing us, we can't wait to see how you use our platform!`,
        },

I've tried using \n\n as well as \r\n\r\n but those don't work either. It's all just one paragraph when I open it in my email.

Any thoughts as to how this can be solved? Thanks in advance!

CodePudding user response:

You can use html tags to get the behavior you want.

For example the <p> tag will create a paragraph with space above and below it.

The following will get you what you want

to: email,
message: {
subject: "Thanks you for registering!",
html: `
  <p>Hey ${firstName || ""}!</p>
  <p>We wanted to take a moment to thank you for signing up with us. We are thrilled to have you on board and can't wait to help you achieve your Real Estate Wholesaling and Investing goals.</p>                
  <p>We are dedicated to providing the best Wholesaling tools to help you succeed. If you have any questions or need assistance, our team is always here to help.</p>            
  <p>Thank you again for choosing us, we can't wait to see how you use our platform!</p>`,
},

If you want multiple lines in between you can add a <br/> tag to create a new line as well.

  • Related