If you try to send a message with line breaks
"Hello!
How are you!?
Cheers!"
Occour an error!
The same message:
"Hello! \n\nHow are you!?\n\nCheers!"
Its ok!
Can you fix it!? Thanks!
Hi,
are you trying to set the linebreaks in your code like this?
{
from: "[email protected]",
to: "[email protected]",
subject: "test mail",
text: "Hello!
How are you!?
Cheers!"
}
This doesn't work since JavaScript doesn't support multi-line strings, you need to go with \n symbols.
{
from: "[email protected]",
to: "[email protected]",
subject: "test mail",
text: "Hello!\n\nHow are you!?\n\nCheers!"
}
Oh! :( Well, its a form to pass an html file like this:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body, p {
margin:0px;
padding: 0px;
}
</style>
</head>
<body>
<p>Ol谩! Isso 茅 um teste!</p>
</body>
</html>
and here to it:
{
from: "[email protected]",
to: "[email protected]",
subject: "test mail",
htmlFile: "myEmailMkt.html"
}
Thanks!
I don't think this is a Nodemailer issue. You should check the input from the file you are reading since Nodemailer doesn't touch line endings at all - it simply passes everything entered to to the server
Most helpful comment
Hi,
are you trying to set the linebreaks in your code like this?
This doesn't work since JavaScript doesn't support multi-line strings, you need to go with \n symbols.