diff --git a/packages/server/src/lib/Mail/index.ts b/packages/server/src/lib/Mail/index.ts index 8310d594e..9381a4e07 100644 --- a/packages/server/src/lib/Mail/index.ts +++ b/packages/server/src/lib/Mail/index.ts @@ -11,6 +11,7 @@ export default class Mail { to: string | string[]; cc: string | string[]; bcc: string | string[]; + replyTo: string | string[]; from: string = `${process.env.MAIL_FROM_NAME} ${process.env.MAIL_FROM_ADDRESS}`; data: { [key: string]: string | number }; attachments: IMailAttachment[]; @@ -27,6 +28,7 @@ export default class Mail { subject: this.subject, html: this.html, attachments: this.attachments, + replyTo: this.replyTo, }; } @@ -74,6 +76,11 @@ export default class Mail { return this; } + setReplyTo(replyTo: string | string[]) { + this.replyTo = replyTo; + return this; + } + /** * Sets from address to the mail. * @param {string} from diff --git a/packages/server/src/services/Sales/Invoices/GetSaleInvoiceMailStateTransformer.ts b/packages/server/src/services/Sales/Invoices/GetSaleInvoiceMailStateTransformer.ts index e1676d845..128080f38 100644 --- a/packages/server/src/services/Sales/Invoices/GetSaleInvoiceMailStateTransformer.ts +++ b/packages/server/src/services/Sales/Invoices/GetSaleInvoiceMailStateTransformer.ts @@ -39,9 +39,19 @@ export class GetSaleInvoiceMailStateTransformer extends SaleInvoiceTransformer { 'companyLogoUri', 'primaryColor', + + 'customerName', ]; }; + /** + * Retrieves the customer name of the invoice. + * @returns {string} + */ + protected customerName = (invoice) => { + return invoice.customer.displayName; + }; + /** * Retrieves the company name. * @returns {string} diff --git a/packages/webapp/src/containers/Sales/Invoices/InvoiceSendMailDrawer/InvoiceSendMailFields.tsx b/packages/webapp/src/containers/Sales/Invoices/InvoiceSendMailDrawer/InvoiceSendMailFields.tsx index 1ae32d1d7..0c4e07b21 100644 --- a/packages/webapp/src/containers/Sales/Invoices/InvoiceSendMailDrawer/InvoiceSendMailFields.tsx +++ b/packages/webapp/src/containers/Sales/Invoices/InvoiceSendMailDrawer/InvoiceSendMailFields.tsx @@ -153,6 +153,13 @@ export function InvoiceSendMailFields() { [setFieldValue], ); + const handleTagInputKeyDown = (e: React.KeyboardEvent) => { + // Prevent the form from submitting when the user presses the Enter key + if (e.key === 'Enter') { + e.preventDefault(); + } + }; + return ( (