gpt4 book ai didi

node.js - 如何在nodeJS中移动到下一行

转载 作者:太空宇宙 更新时间:2023-11-03 23:17:07 29 4
gpt4 key购买 nike

今天,我刚刚开始使用 firebase NodeJs 身份验证触发器,在用户首次注册时发送欢迎电子邮件。这是官方文档中的index.js文件(已修改)

const APP_NAME = 'Incredible India Tourism';


exports.sendWelcomeEmail = functions.auth.user().onCreate((user) => {

const email = user.email; // The email of the user.
const displayName = user.displayName; // The display name of the user.


return sendWelcomeEmail(email, displayName);
});

exports.sendByeEmail = functions.auth.user().onDelete((user) => {
// [END onDeleteTrigger]
const email = user.email;
const displayName = user.displayName;

return sendGoodbyeEmail(email, displayName);
});
// [END sendByeEmail]

// Sends a welcome email to the given user.
function sendWelcomeEmail(email, displayName) {
const mailOptions = {
from: `${APP_NAME} <noreply@firebase.com>`,
to: email,
};

// The user subscribed to the newsletter.
mailOptions.subject = `Welcome to ${APP_NAME}!`;
mailOptions.text = `Hey ${displayName || ''}! Welcome to ${APP_NAME}. We hope you will enjoy our service.`;
return mailTransport.sendMail(mailOptions).then(() => {
return console.log('New welcome email sent to:', email);
});
}

// Sends a goodbye email to the given user.
function sendGoodbyeEmail(email, displayName) {
const mailOptions = {
from: `${APP_NAME} <noreply@firebase.com>`,
to: email,
};

// The user unsubscribed to the newsletter.
mailOptions.subject = `Bye!`;
mailOptions.text = `Hey ${displayName || ''}!, We confirm that we have deleted your ${APP_NAME} account.`;
return mailTransport.sendMail(mailOptions).then(() => {
return console.log('Account deletion confirmation email sent to:', email);
});
}

但是我如何移动到这一行的下一行

 mailOptions.text = `Hey ${displayName || ''}! Welcome to ${APP_NAME}. We hope you will enjoy our service.`;

我想移至下一行

Welcome to ${APP_NAME}

最佳答案

您可以尝试一下并分享输出吗...

 mailOptions.text = `Hey ${displayName || ''}! Welcome to ${APP_NAME}. \n We hope you will enjoy our service.`;

如果您想包含图像链接,则必须插入 html 选项...之前的代码(上方)发送纯文本电子邮件

mailOptions.html = `
Hey ${displayName || ''}! Welcome to ${APP_NAME}.
<br />
<img src="cid:logo">
<br/>
We hope you will enjoy our service. <br/> `;

mailOptions.attachments = [{
filename: 'angular.png',
path: 'https://www.akberiqbal.com/logos/angular.png',
cid: 'logo'
}]

关于node.js - 如何在nodeJS中移动到下一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54038058/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com