Nodemailer: “正文”中的换行问题:

创建于 2011-08-24  ·  3评论  ·  资料来源: nodemailer/nodemailer

如果您尝试发送带有换行符的消息

“你好!

你好吗!?

干杯!”

出现错误!

同样的消息:

“你好!\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!"
}

所有3条评论

你好,

你想在你的代码中像这样设置换行符吗?

{
    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 根本不接触行尾 - 它只是将输入的所有内容传递给服务器

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

pranavpunjabi picture pranavpunjabi  ·  3评论

anonprophet picture anonprophet  ·  3评论

ghost picture ghost  ·  3评论

tegarkurniawan picture tegarkurniawan  ·  3评论

connor11528 picture connor11528  ·  6评论