diff --git a/packages/mail/src/classes/mail-service.js b/packages/mail/src/classes/mail-service.js index 8f4bb8bb1..111930985 100644 --- a/packages/mail/src/classes/mail-service.js +++ b/packages/mail/src/classes/mail-service.js @@ -180,18 +180,20 @@ class MailService { //Send mail try { + // copy object to avoid mutating original + const args = data; //Append multiple flag to data if not set if (typeof data.isMultiple === 'undefined') { - data.isMultiple = isMultiple; + args.isMultiple = isMultiple; } //Append global substitution wrappers if not set in data if (typeof data.substitutionWrappers === 'undefined') { - data.substitutionWrappers = this.substitutionWrappers; + args.substitutionWrappers = this.substitutionWrappers; } //Create Mail instance from data and get JSON body for request - const mail = Mail.create(data); + const mail = Mail.create(args); const body = mail.toJSON(); //Filters the Mail body to avoid sensitive content leakage