hard coded bcc added for time bieng
This commit is contained in:
parent
e875e7fe7a
commit
0890ffe74d
@ -17,6 +17,12 @@ interface EmailOptions {
|
|||||||
attachments?: any[];
|
attachments?: any[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hardcoded BCC addresses (temporary - for time being)
|
||||||
|
const HARDCODED_BCC: string[] = [
|
||||||
|
'rohitm_ext@royalenfield.com',
|
||||||
|
// Add your BCC email addresses here
|
||||||
|
];
|
||||||
|
|
||||||
export class EmailService {
|
export class EmailService {
|
||||||
private transporter: nodemailer.Transporter | null = null;
|
private transporter: nodemailer.Transporter | null = null;
|
||||||
private useTestAccount: boolean = false;
|
private useTestAccount: boolean = false;
|
||||||
@ -103,11 +109,22 @@ export class EmailService {
|
|||||||
const recipients = Array.isArray(options.to) ? options.to.join(', ') : options.to;
|
const recipients = Array.isArray(options.to) ? options.to.join(', ') : options.to;
|
||||||
const fromAddress = process.env.EMAIL_FROM || 'RE Flow <noreply@royalenfield.com>';
|
const fromAddress = process.env.EMAIL_FROM || 'RE Flow <noreply@royalenfield.com>';
|
||||||
|
|
||||||
|
// Merge hardcoded BCC with provided BCC
|
||||||
|
let bccRecipients: string[] = [];
|
||||||
|
if (HARDCODED_BCC.length > 0) {
|
||||||
|
bccRecipients = [...HARDCODED_BCC];
|
||||||
|
}
|
||||||
|
if (options.bcc) {
|
||||||
|
const providedBcc = Array.isArray(options.bcc) ? options.bcc : [options.bcc];
|
||||||
|
bccRecipients = [...bccRecipients, ...providedBcc];
|
||||||
|
}
|
||||||
|
const finalBcc = bccRecipients.length > 0 ? bccRecipients : undefined;
|
||||||
|
|
||||||
const mailOptions = {
|
const mailOptions = {
|
||||||
from: fromAddress,
|
from: fromAddress,
|
||||||
to: recipients,
|
to: recipients,
|
||||||
cc: options.cc,
|
cc: options.cc,
|
||||||
bcc: options.bcc,
|
bcc: finalBcc,
|
||||||
subject: options.subject,
|
subject: options.subject,
|
||||||
html: options.html,
|
html: options.html,
|
||||||
attachments: options.attachments
|
attachments: options.attachments
|
||||||
@ -141,6 +158,9 @@ export class EmailService {
|
|||||||
console.log('\n' + '='.repeat(80));
|
console.log('\n' + '='.repeat(80));
|
||||||
console.log(`📧 EMAIL PREVIEW (${options.subject})`);
|
console.log(`📧 EMAIL PREVIEW (${options.subject})`);
|
||||||
console.log(`To: ${recipients}`);
|
console.log(`To: ${recipients}`);
|
||||||
|
if (finalBcc && finalBcc.length > 0) {
|
||||||
|
console.log(`BCC: ${finalBcc.join(', ')}`);
|
||||||
|
}
|
||||||
console.log(`Preview URL: ${previewUrl}`);
|
console.log(`Preview URL: ${previewUrl}`);
|
||||||
console.log(`Message ID: ${info.messageId}`);
|
console.log(`Message ID: ${info.messageId}`);
|
||||||
console.log('='.repeat(80) + '\n');
|
console.log('='.repeat(80) + '\n');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user