strapi-plugin-magic-mail 2.8.1 → 2.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2018,7 +2018,7 @@ var license$1 = ({ strapi: strapi2 }) => ({
2018
2018
  valid: verification.valid,
2019
2019
  demo: false,
2020
2020
  data: {
2021
- licenseKey: licenseKey ? licenseKey.substring(0, 8) + "..." + licenseKey.substring(licenseKey.length - 4) : null,
2021
+ licenseKey,
2022
2022
  email: license2?.email || null,
2023
2023
  firstName: license2?.firstName || null,
2024
2024
  lastName: license2?.lastName || null,
@@ -4032,13 +4032,15 @@ const { decryptCredentials: decryptCredentials$1 } = encryption;
4032
4032
  var emailRouter$1 = ({ strapi: strapi2 }) => ({
4033
4033
  /**
4034
4034
  * Send email with smart routing
4035
- * @param {Object} emailData - { to, from, subject, text, html, attachments, type, priority, templateId, templateData OR data }
4035
+ * @param {Object} emailData - { to, from, cc, bcc, subject, text, html, replyTo, attachments, type, priority, templateId, templateData OR data }
4036
4036
  * @returns {Promise<Object>} Send result
4037
4037
  */
4038
4038
  async send(emailData) {
4039
4039
  let {
4040
4040
  to,
4041
4041
  from,
4042
+ cc,
4043
+ bcc,
4042
4044
  subject,
4043
4045
  text,
4044
4046
  html,
@@ -4089,11 +4091,13 @@ var emailRouter$1 = ({ strapi: strapi2 }) => ({
4089
4091
  to = normalizeAddrs(to);
4090
4092
  from = normalizeAddr(from);
4091
4093
  replyTo = normalizeAddr(replyTo);
4094
+ if (cc) cc = normalizeAddrs(cc);
4095
+ if (bcc) bcc = normalizeAddrs(bcc);
4092
4096
  emailData.to = to;
4093
4097
  emailData.from = from;
4094
4098
  emailData.replyTo = replyTo;
4095
- if (emailData.cc) emailData.cc = normalizeAddrs(emailData.cc);
4096
- if (emailData.bcc) emailData.bcc = normalizeAddrs(emailData.bcc);
4099
+ emailData.cc = cc;
4100
+ emailData.bcc = bcc;
4097
4101
  if (skipLinkTracking) {
4098
4102
  strapi2.log.info(`[magic-mail] [SKIP-TRACK] skipLinkTracking=true received for email to: ${to}`);
4099
4103
  }
@@ -4433,6 +4437,8 @@ ${text || "Email delivery failed. Please check your email settings."}`;
4433
4437
  const mailOptions = {
4434
4438
  from: emailData.from || `${account.fromName || "MagicMail"} <${account.fromEmail}>`,
4435
4439
  to: emailData.to,
4440
+ ...emailData.cc && { cc: emailData.cc },
4441
+ ...emailData.bcc && { bcc: emailData.bcc },
4436
4442
  replyTo: emailData.replyTo || account.replyTo,
4437
4443
  subject: emailData.subject,
4438
4444
  text: emailData.text,
@@ -4550,6 +4556,8 @@ ${text || "Email delivery failed. Please check your email settings."}`;
4550
4556
  `Content-Type: multipart/mixed; boundary="${boundary}"`,
4551
4557
  "X-Mailer: MagicMail/1.0"
4552
4558
  ];
4559
+ if (emailData.cc) emailLines.push(`Cc: ${emailData.cc}`);
4560
+ if (emailData.bcc) emailLines.push(`Bcc: ${emailData.bcc}`);
4553
4561
  if (emailData.priority === "high") {
4554
4562
  emailLines.push("X-Priority: 1 (Highest)");
4555
4563
  emailLines.push("Importance: high");
@@ -4616,6 +4624,8 @@ ${text || "Email delivery failed. Please check your email settings."}`;
4616
4624
  "Content-Type: text/html; charset=utf-8",
4617
4625
  "X-Mailer: MagicMail/1.0"
4618
4626
  ];
4627
+ if (emailData.cc) emailLines.push(`Cc: ${emailData.cc}`);
4628
+ if (emailData.bcc) emailLines.push(`Bcc: ${emailData.bcc}`);
4619
4629
  if (emailData.priority === "high") {
4620
4630
  emailLines.push("X-Priority: 1 (Highest)");
4621
4631
  emailLines.push("Importance: high");
@@ -4732,6 +4742,8 @@ ${text || "Email delivery failed. Please check your email settings."}`;
4732
4742
  `Content-Type: multipart/mixed; boundary="${boundary}"`,
4733
4743
  "X-Mailer: MagicMail/1.0"
4734
4744
  ];
4745
+ if (emailData.cc) mimeLines.push(`Cc: ${emailData.cc}`);
4746
+ if (emailData.bcc) mimeLines.push(`Bcc: ${emailData.bcc}`);
4735
4747
  if (emailData.priority === "high") {
4736
4748
  mimeLines.push("X-Priority: 1 (Highest)");
4737
4749
  mimeLines.push("Importance: high");
@@ -4783,6 +4795,8 @@ ${text || "Email delivery failed. Please check your email settings."}`;
4783
4795
  "Content-Type: text/html; charset=utf-8",
4784
4796
  "X-Mailer: MagicMail/1.0"
4785
4797
  ];
4798
+ if (emailData.cc) mimeLines.push(`Cc: ${emailData.cc}`);
4799
+ if (emailData.bcc) mimeLines.push(`Bcc: ${emailData.bcc}`);
4786
4800
  if (emailData.priority === "high") {
4787
4801
  mimeLines.push("X-Priority: 1 (Highest)");
4788
4802
  mimeLines.push("Importance: high");
@@ -4892,6 +4906,8 @@ ${text || "Email delivery failed. Please check your email settings."}`;
4892
4906
  const mailOptions = {
4893
4907
  from: `${account.fromName || "Yahoo Mail"} <${account.fromEmail}>`,
4894
4908
  to: emailData.to,
4909
+ ...emailData.cc && { cc: emailData.cc },
4910
+ ...emailData.bcc && { bcc: emailData.bcc },
4895
4911
  replyTo: emailData.replyTo || account.replyTo,
4896
4912
  subject: emailData.subject,
4897
4913
  text: emailData.text,
@@ -4936,15 +4952,26 @@ ${text || "Email delivery failed. Please check your email settings."}`;
4936
4952
  this.validateEmailSecurity(emailData);
4937
4953
  strapi2.log.info(`[magic-mail] Sending via SendGrid for account: ${account.name}`);
4938
4954
  try {
4955
+ const personalization = { to: [{ email: emailData.to }] };
4956
+ if (emailData.cc) {
4957
+ const ccList = Array.isArray(emailData.cc) ? emailData.cc : emailData.cc.split(",").map((e) => e.trim());
4958
+ personalization.cc = ccList.map((email) => ({ email }));
4959
+ }
4960
+ if (emailData.bcc) {
4961
+ const bccList = Array.isArray(emailData.bcc) ? emailData.bcc : emailData.bcc.split(",").map((e) => e.trim());
4962
+ personalization.bcc = bccList.map((email) => ({ email }));
4963
+ }
4939
4964
  const msg = {
4940
- to: emailData.to,
4965
+ personalizations: [personalization],
4941
4966
  from: {
4942
4967
  email: account.fromEmail,
4943
4968
  name: account.fromName || account.fromEmail
4944
4969
  },
4945
4970
  subject: emailData.subject,
4946
- text: emailData.text,
4947
- html: emailData.html,
4971
+ content: [
4972
+ ...emailData.text ? [{ type: "text/plain", value: emailData.text }] : [],
4973
+ ...emailData.html ? [{ type: "text/html", value: emailData.html }] : []
4974
+ ],
4948
4975
  // Security and tracking headers
4949
4976
  customArgs: {
4950
4977
  "magicmail_version": "1.0",
@@ -5039,6 +5066,8 @@ ${text || "Email delivery failed. Please check your email settings."}`;
5039
5066
  account.fromName ? `${account.fromName} <${account.fromEmail}>` : account.fromEmail
5040
5067
  );
5041
5068
  form.append("to", emailData.to);
5069
+ if (emailData.cc) form.append("cc", emailData.cc);
5070
+ if (emailData.bcc) form.append("bcc", emailData.bcc);
5042
5071
  form.append("subject", emailData.subject);
5043
5072
  if (emailData.html) {
5044
5073
  form.append("html", emailData.html);
@@ -6086,7 +6115,7 @@ var oauth$1 = ({ strapi: strapi2 }) => ({
6086
6115
  return account;
6087
6116
  }
6088
6117
  });
6089
- const version = "2.8.0";
6118
+ const version = "2.8.2";
6090
6119
  const require$$2 = {
6091
6120
  version
6092
6121
  };
@@ -2008,7 +2008,7 @@ var license$1 = ({ strapi: strapi2 }) => ({
2008
2008
  valid: verification.valid,
2009
2009
  demo: false,
2010
2010
  data: {
2011
- licenseKey: licenseKey ? licenseKey.substring(0, 8) + "..." + licenseKey.substring(licenseKey.length - 4) : null,
2011
+ licenseKey,
2012
2012
  email: license2?.email || null,
2013
2013
  firstName: license2?.firstName || null,
2014
2014
  lastName: license2?.lastName || null,
@@ -4022,13 +4022,15 @@ const { decryptCredentials: decryptCredentials$1 } = encryption;
4022
4022
  var emailRouter$1 = ({ strapi: strapi2 }) => ({
4023
4023
  /**
4024
4024
  * Send email with smart routing
4025
- * @param {Object} emailData - { to, from, subject, text, html, attachments, type, priority, templateId, templateData OR data }
4025
+ * @param {Object} emailData - { to, from, cc, bcc, subject, text, html, replyTo, attachments, type, priority, templateId, templateData OR data }
4026
4026
  * @returns {Promise<Object>} Send result
4027
4027
  */
4028
4028
  async send(emailData) {
4029
4029
  let {
4030
4030
  to,
4031
4031
  from,
4032
+ cc,
4033
+ bcc,
4032
4034
  subject,
4033
4035
  text,
4034
4036
  html,
@@ -4079,11 +4081,13 @@ var emailRouter$1 = ({ strapi: strapi2 }) => ({
4079
4081
  to = normalizeAddrs(to);
4080
4082
  from = normalizeAddr(from);
4081
4083
  replyTo = normalizeAddr(replyTo);
4084
+ if (cc) cc = normalizeAddrs(cc);
4085
+ if (bcc) bcc = normalizeAddrs(bcc);
4082
4086
  emailData.to = to;
4083
4087
  emailData.from = from;
4084
4088
  emailData.replyTo = replyTo;
4085
- if (emailData.cc) emailData.cc = normalizeAddrs(emailData.cc);
4086
- if (emailData.bcc) emailData.bcc = normalizeAddrs(emailData.bcc);
4089
+ emailData.cc = cc;
4090
+ emailData.bcc = bcc;
4087
4091
  if (skipLinkTracking) {
4088
4092
  strapi2.log.info(`[magic-mail] [SKIP-TRACK] skipLinkTracking=true received for email to: ${to}`);
4089
4093
  }
@@ -4423,6 +4427,8 @@ ${text || "Email delivery failed. Please check your email settings."}`;
4423
4427
  const mailOptions = {
4424
4428
  from: emailData.from || `${account.fromName || "MagicMail"} <${account.fromEmail}>`,
4425
4429
  to: emailData.to,
4430
+ ...emailData.cc && { cc: emailData.cc },
4431
+ ...emailData.bcc && { bcc: emailData.bcc },
4426
4432
  replyTo: emailData.replyTo || account.replyTo,
4427
4433
  subject: emailData.subject,
4428
4434
  text: emailData.text,
@@ -4540,6 +4546,8 @@ ${text || "Email delivery failed. Please check your email settings."}`;
4540
4546
  `Content-Type: multipart/mixed; boundary="${boundary}"`,
4541
4547
  "X-Mailer: MagicMail/1.0"
4542
4548
  ];
4549
+ if (emailData.cc) emailLines.push(`Cc: ${emailData.cc}`);
4550
+ if (emailData.bcc) emailLines.push(`Bcc: ${emailData.bcc}`);
4543
4551
  if (emailData.priority === "high") {
4544
4552
  emailLines.push("X-Priority: 1 (Highest)");
4545
4553
  emailLines.push("Importance: high");
@@ -4606,6 +4614,8 @@ ${text || "Email delivery failed. Please check your email settings."}`;
4606
4614
  "Content-Type: text/html; charset=utf-8",
4607
4615
  "X-Mailer: MagicMail/1.0"
4608
4616
  ];
4617
+ if (emailData.cc) emailLines.push(`Cc: ${emailData.cc}`);
4618
+ if (emailData.bcc) emailLines.push(`Bcc: ${emailData.bcc}`);
4609
4619
  if (emailData.priority === "high") {
4610
4620
  emailLines.push("X-Priority: 1 (Highest)");
4611
4621
  emailLines.push("Importance: high");
@@ -4722,6 +4732,8 @@ ${text || "Email delivery failed. Please check your email settings."}`;
4722
4732
  `Content-Type: multipart/mixed; boundary="${boundary}"`,
4723
4733
  "X-Mailer: MagicMail/1.0"
4724
4734
  ];
4735
+ if (emailData.cc) mimeLines.push(`Cc: ${emailData.cc}`);
4736
+ if (emailData.bcc) mimeLines.push(`Bcc: ${emailData.bcc}`);
4725
4737
  if (emailData.priority === "high") {
4726
4738
  mimeLines.push("X-Priority: 1 (Highest)");
4727
4739
  mimeLines.push("Importance: high");
@@ -4773,6 +4785,8 @@ ${text || "Email delivery failed. Please check your email settings."}`;
4773
4785
  "Content-Type: text/html; charset=utf-8",
4774
4786
  "X-Mailer: MagicMail/1.0"
4775
4787
  ];
4788
+ if (emailData.cc) mimeLines.push(`Cc: ${emailData.cc}`);
4789
+ if (emailData.bcc) mimeLines.push(`Bcc: ${emailData.bcc}`);
4776
4790
  if (emailData.priority === "high") {
4777
4791
  mimeLines.push("X-Priority: 1 (Highest)");
4778
4792
  mimeLines.push("Importance: high");
@@ -4882,6 +4896,8 @@ ${text || "Email delivery failed. Please check your email settings."}`;
4882
4896
  const mailOptions = {
4883
4897
  from: `${account.fromName || "Yahoo Mail"} <${account.fromEmail}>`,
4884
4898
  to: emailData.to,
4899
+ ...emailData.cc && { cc: emailData.cc },
4900
+ ...emailData.bcc && { bcc: emailData.bcc },
4885
4901
  replyTo: emailData.replyTo || account.replyTo,
4886
4902
  subject: emailData.subject,
4887
4903
  text: emailData.text,
@@ -4926,15 +4942,26 @@ ${text || "Email delivery failed. Please check your email settings."}`;
4926
4942
  this.validateEmailSecurity(emailData);
4927
4943
  strapi2.log.info(`[magic-mail] Sending via SendGrid for account: ${account.name}`);
4928
4944
  try {
4945
+ const personalization = { to: [{ email: emailData.to }] };
4946
+ if (emailData.cc) {
4947
+ const ccList = Array.isArray(emailData.cc) ? emailData.cc : emailData.cc.split(",").map((e) => e.trim());
4948
+ personalization.cc = ccList.map((email) => ({ email }));
4949
+ }
4950
+ if (emailData.bcc) {
4951
+ const bccList = Array.isArray(emailData.bcc) ? emailData.bcc : emailData.bcc.split(",").map((e) => e.trim());
4952
+ personalization.bcc = bccList.map((email) => ({ email }));
4953
+ }
4929
4954
  const msg = {
4930
- to: emailData.to,
4955
+ personalizations: [personalization],
4931
4956
  from: {
4932
4957
  email: account.fromEmail,
4933
4958
  name: account.fromName || account.fromEmail
4934
4959
  },
4935
4960
  subject: emailData.subject,
4936
- text: emailData.text,
4937
- html: emailData.html,
4961
+ content: [
4962
+ ...emailData.text ? [{ type: "text/plain", value: emailData.text }] : [],
4963
+ ...emailData.html ? [{ type: "text/html", value: emailData.html }] : []
4964
+ ],
4938
4965
  // Security and tracking headers
4939
4966
  customArgs: {
4940
4967
  "magicmail_version": "1.0",
@@ -5029,6 +5056,8 @@ ${text || "Email delivery failed. Please check your email settings."}`;
5029
5056
  account.fromName ? `${account.fromName} <${account.fromEmail}>` : account.fromEmail
5030
5057
  );
5031
5058
  form.append("to", emailData.to);
5059
+ if (emailData.cc) form.append("cc", emailData.cc);
5060
+ if (emailData.bcc) form.append("bcc", emailData.bcc);
5032
5061
  form.append("subject", emailData.subject);
5033
5062
  if (emailData.html) {
5034
5063
  form.append("html", emailData.html);
@@ -6076,7 +6105,7 @@ var oauth$1 = ({ strapi: strapi2 }) => ({
6076
6105
  return account;
6077
6106
  }
6078
6107
  });
6079
- const version = "2.8.0";
6108
+ const version = "2.8.2";
6080
6109
  const require$$2 = {
6081
6110
  version
6082
6111
  };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.8.1",
2
+ "version": "2.8.3",
3
3
  "keywords": [
4
4
  "strapi",
5
5
  "strapi-plugin",
@@ -55,7 +55,7 @@
55
55
  "form-data": "^4.0.4",
56
56
  "html-to-text": "^9.0.5",
57
57
  "mustache": "^4.2.0",
58
- "nodemailer": "^7.0.12",
58
+ "nodemailer": "^8.0.1",
59
59
  "pino": "^9.5.0",
60
60
  "qrcode": "^1.5.4",
61
61
  "react-email-editor": "^1.7.11",