Node.js newline characters do not work

ask for help, recently writing the email function in the project. Is to send an e-mail to the designated mailbox. But now it is found that the newline character looks like it doesn"t work in the mailbox, and it automatically becomes a line. I don"t know how to modify it. The code is as follows:

 var emailContent =  "Time: \n" + t + 
                    " Id:\n" + id +
                    " Content:\n  " + content;
  sendEmail("New content",emailContent);

uses nodemailer. Does n need to be converted to
?

Mar.10,2021

should be just a display problem. Try \ r\ n and try


with \ r\ n line break


let emailContent = `
  Time:
  Id:${id}
  Content:${content}
`

Test it like this

The

template string (template string) is an enhanced version of the string, identified by backquotes (`). It can be used as a normal string, to define a multiline string, or to embed variables in a string.


if it is rich text, try using

or br / > directly?

let emailContent = `

Time:${t}

Id:${id}

Content:${content}

`
Menu