假设我想发送一封电子邮件至 ,recipient@xyz.com并将密件抄送副本发送至bcc@xyz.com。
当bcc@xyz.com他收到电子邮件时,他应该recipient@xyz.com在收件人字段和bcc@xyz.com密件抄送字段中看到。
但是当bcc@xyz.com收到邮件时,他无法recipient@xyz.com在收件人字段中看到。
我尝试使用邮件编辑器而不是传输来创建和发送电子邮件,但它没有按预期工作。
我也试过 cc 但 cc 没有按预期工作。
const nodemailer = require('nodemailer');
const testAccount = await nodemailer.createTestAccount();
const transporter = nodemailer.createTransport({
host: "smtp.ethereal.email",
auth: {
user: testAccount.user,
pass: testAccount.pass
},
tls: { rejectUnauthorized: false }
});
const mailData = {
from: 'xyz@xyz.com',
to: 'recipient@xyz.com',
bcc: 'bcc@xyz.com',
subject: 'Sample Mail',
html: text
}
const result = await transporter.sendMail(mailData);
console.log('Mail Sent! \t ID: ' + result.messageId); …Run Code Online (Sandbox Code Playgroud) 在定义关联时,有没有办法在 sequelize 上显式添加类型转换?Transaction Details 表和 Products 表具有 1:M 关联,它们的定义如下:
db.models.TransactionDetails.hasMany(db.models.Products,{
sourceKey: 'productId', //this has a data type of character varying
foreignKey: 'recordId' // this is bigint
});
Run Code Online (Sandbox Code Playgroud)
我收到错误“SequelizeDatabaseError:没有运算符匹配给定的名称和参数类型。您可能需要添加显式类型转换。” 当我做包含时,因为它们具有不同的数据类型。更改 postgres 上的表不是解决方案,因为这仅在本地主机上。
我正在开发一个 API,UI 的要求基于我将收到过滤结果的搜索字段的值。UI 上有很多搜索字段。
示例代码 -
async getRoomsByMember(active: boolean, email: string): Promise<any[]> {
return await getRepository(Room)
.createQueryBuilder('room')
.innerJoinAndSelect('room.member', 'member')
.where("room.active = :active", {active: active})
.andWhere("member.email = :email", { email: email })
.getMany();
}
Run Code Online (Sandbox Code Playgroud)
如果用户在过滤字段(例如成员电话号码、城市、州、国家和邮政编码)中输入值,我将能够动态过滤房间成员。
node.js ×3
javascript ×1
nestjs ×1
nodemailer ×1
orm ×1
postgresql ×1
sequelize.js ×1
typeorm ×1