如何移动到nodeJS中的下一行
How to move to next line in nodeJS
今天我刚开始使用 firebase NodeJs authenciation 触发器在用户首次注册时发送欢迎电子邮件。这是来自官方文档的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 选项 如果你想在图像中包含一个 link... 前面的代码(上面) 发送纯文本电子邮件
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'
}]
今天我刚开始使用 firebase NodeJs authenciation 触发器在用户首次注册时发送欢迎电子邮件。这是来自官方文档的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 选项 如果你想在图像中包含一个 link... 前面的代码(上面) 发送纯文本电子邮件
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'
}]