mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
fix: hook up cc and bcc fields to mail sender
This commit is contained in:
@@ -9,6 +9,8 @@ export default class Mail {
|
|||||||
subject: string = '';
|
subject: string = '';
|
||||||
content: string = '';
|
content: string = '';
|
||||||
to: string | string[];
|
to: string | string[];
|
||||||
|
cc: string | string[];
|
||||||
|
bcc: string | string[];
|
||||||
from: string = `${process.env.MAIL_FROM_NAME} ${process.env.MAIL_FROM_ADDRESS}`;
|
from: string = `${process.env.MAIL_FROM_NAME} ${process.env.MAIL_FROM_ADDRESS}`;
|
||||||
data: { [key: string]: string | number };
|
data: { [key: string]: string | number };
|
||||||
attachments: IMailAttachment[];
|
attachments: IMailAttachment[];
|
||||||
@@ -20,6 +22,8 @@ export default class Mail {
|
|||||||
return {
|
return {
|
||||||
to: this.to,
|
to: this.to,
|
||||||
from: this.from,
|
from: this.from,
|
||||||
|
cc: this.cc,
|
||||||
|
bcc: this.bcc,
|
||||||
subject: this.subject,
|
subject: this.subject,
|
||||||
html: this.html,
|
html: this.html,
|
||||||
attachments: this.attachments,
|
attachments: this.attachments,
|
||||||
@@ -60,6 +64,16 @@ export default class Mail {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setCC(cc: string | string[]) {
|
||||||
|
this.cc = cc;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
setBCC(bcc: string | string[]) {
|
||||||
|
this.bcc = bcc;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets from address to the mail.
|
* Sets from address to the mail.
|
||||||
* @param {string} from
|
* @param {string} from
|
||||||
|
|||||||
@@ -126,7 +126,6 @@ export class SendSaleEstimateMail {
|
|||||||
mailOptions: SaleEstimateMailOptions
|
mailOptions: SaleEstimateMailOptions
|
||||||
): Promise<SaleEstimateMailOptions> => {
|
): Promise<SaleEstimateMailOptions> => {
|
||||||
const formatterArgs = await this.formatterArgs(tenantId, saleEstimateId);
|
const formatterArgs = await this.formatterArgs(tenantId, saleEstimateId);
|
||||||
|
|
||||||
const formattedOptions =
|
const formattedOptions =
|
||||||
await this.contactMailNotification.formatMailOptions(
|
await this.contactMailNotification.formatMailOptions(
|
||||||
tenantId,
|
tenantId,
|
||||||
@@ -166,6 +165,8 @@ export class SendSaleEstimateMail {
|
|||||||
const mail = new Mail()
|
const mail = new Mail()
|
||||||
.setSubject(formattedOptions.subject)
|
.setSubject(formattedOptions.subject)
|
||||||
.setTo(formattedOptions.to)
|
.setTo(formattedOptions.to)
|
||||||
|
.setCC(formattedOptions.cc)
|
||||||
|
.setBCC(formattedOptions.bcc)
|
||||||
.setContent(formattedOptions.message);
|
.setContent(formattedOptions.message);
|
||||||
|
|
||||||
// Attaches the estimate pdf to the mail.
|
// Attaches the estimate pdf to the mail.
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ export class SendSaleInvoiceMail {
|
|||||||
const mail = new Mail()
|
const mail = new Mail()
|
||||||
.setSubject(formattedMessageOptions.subject)
|
.setSubject(formattedMessageOptions.subject)
|
||||||
.setTo(formattedMessageOptions.to)
|
.setTo(formattedMessageOptions.to)
|
||||||
|
.setCC(formattedMessageOptions.cc)
|
||||||
|
.setBCC(formattedMessageOptions.bcc)
|
||||||
.setContent(formattedMessageOptions.message);
|
.setContent(formattedMessageOptions.message);
|
||||||
|
|
||||||
// Attach invoice document.
|
// Attach invoice document.
|
||||||
@@ -89,7 +91,6 @@ export class SendSaleInvoiceMail {
|
|||||||
{ filename: `${invoiceFilename}.pdf`, content: invoicePdfBuffer },
|
{ filename: `${invoiceFilename}.pdf`, content: invoicePdfBuffer },
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const eventPayload = {
|
const eventPayload = {
|
||||||
tenantId,
|
tenantId,
|
||||||
saleInvoiceId,
|
saleInvoiceId,
|
||||||
|
|||||||
@@ -135,6 +135,8 @@ export class SendPaymentReceiveMailNotification {
|
|||||||
const mail = new Mail()
|
const mail = new Mail()
|
||||||
.setSubject(parsedMessageOpts.subject)
|
.setSubject(parsedMessageOpts.subject)
|
||||||
.setTo(parsedMessageOpts.to)
|
.setTo(parsedMessageOpts.to)
|
||||||
|
.setCC(parsedMessageOpts.cc)
|
||||||
|
.setBCC(parsedMessageOpts.bcc)
|
||||||
.setContent(parsedMessageOpts.message);
|
.setContent(parsedMessageOpts.message);
|
||||||
|
|
||||||
const eventPayload = {
|
const eventPayload = {
|
||||||
|
|||||||
@@ -139,6 +139,8 @@ export class SaleReceiptMailNotification {
|
|||||||
const mail = new Mail()
|
const mail = new Mail()
|
||||||
.setSubject(parsedMessageOpts.subject)
|
.setSubject(parsedMessageOpts.subject)
|
||||||
.setTo(parsedMessageOpts.to)
|
.setTo(parsedMessageOpts.to)
|
||||||
|
.setCC(parsedMessageOpts.cc)
|
||||||
|
.setBCC(parsedMessageOpts.bcc)
|
||||||
.setContent(parsedMessageOpts.message);
|
.setContent(parsedMessageOpts.message);
|
||||||
|
|
||||||
// Attaches the receipt pdf document.
|
// Attaches the receipt pdf document.
|
||||||
|
|||||||
Reference in New Issue
Block a user