secondary email
This commit is contained in:
@@ -111,12 +111,18 @@ function generateInvoiceEmailHtml(invoice, customText, stripePaymentUrl) {
|
||||
return result.html;
|
||||
}
|
||||
|
||||
async function sendInvoiceEmail(invoice, recipientEmail, customText, stripePaymentUrl, pdfBuffer) {
|
||||
async function sendInvoiceEmail(invoice, recipients, customText, stripePaymentUrl, pdfBuffer) {
|
||||
const htmlContent = generateInvoiceEmailHtml(invoice, customText, stripePaymentUrl);
|
||||
|
||||
// Akzeptiert String oder Array. nodemailer akzeptiert beides direkt im "to"-Feld,
|
||||
// aber wir normalisieren für Konsistenz und einfacheres Logging.
|
||||
const toList = Array.isArray(recipients)
|
||||
? recipients
|
||||
: [recipients].filter(Boolean);
|
||||
|
||||
const mailOptions = {
|
||||
from: '"Bay Area Affiliates Inc. Accounting" <accounting@bayarea-cc.com>',
|
||||
to: recipientEmail,
|
||||
to: toList.join(', '),
|
||||
bcc: 'accounting@bayarea-cc.com',
|
||||
subject: `Invoice #${invoice.invoice_number || invoice.id} from Bay Area Affiliates, Inc.`,
|
||||
html: htmlContent,
|
||||
|
||||
Reference in New Issue
Block a user