如果您尝试发送带有换行符的消息
“你好!
你好吗!?
干杯!”
出现错误!
同样的消息:
“你好!\n\n你好吗!?\n\n干杯!”
没关系!
你能修好它吗!? 谢谢!
你好,
你想在你的代码中像这样设置换行符吗?
{
from: "[email protected]",
to: "[email protected]",
subject: "test mail",
text: "Hello!
How are you!?
Cheers!"
}
这不起作用,因为 JavaScript 不支持多行字符串,您需要使用 \n 符号。
{
from: "[email protected]",
to: "[email protected]",
subject: "test mail",
text: "Hello!\n\nHow are you!?\n\nCheers!"
}
哦! :( 好吧,它是一种传递 html 文件的形式,如下所示:
<!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>
在这里:
{
from: "[email protected]",
to: "[email protected]",
subject: "test mail",
htmlFile: "myEmailMkt.html"
}
谢谢!
我不认为这是 Nodemailer 的问题。 您应该检查正在阅读的文件中的输入,因为 Nodemailer 根本不接触行尾 - 它只是将输入的所有内容传递给服务器
最有用的评论
你好,
你想在你的代码中像这样设置换行符吗?
这不起作用,因为 JavaScript 不支持多行字符串,您需要使用 \n 符号。