@bobfrankston/rmfmail 1.2.33 → 1.2.35

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.
@@ -5767,6 +5767,7 @@ var WebMailxService = class {
5767
5767
  let bodyText = "";
5768
5768
  let hasRemoteContent = false;
5769
5769
  let attachments = [];
5770
+ let deliveredTo = "", returnPath = "", listUnsubscribe = "";
5770
5771
  let raw = null;
5771
5772
  try {
5772
5773
  raw = await this.syncManager.fetchMessageBody(accountId, envelope.folderId, envelope.uid);
@@ -5813,6 +5814,27 @@ var WebMailxService = class {
5813
5814
  size: a.size || 0,
5814
5815
  contentId: a.contentId || ""
5815
5816
  }));
5817
+ const hEnd = source.search(/\r?\n\r?\n/);
5818
+ const hb = hEnd >= 0 ? source.slice(0, hEnd) : source;
5819
+ const unfolded = [];
5820
+ for (const ln of hb.split(/\r?\n/)) {
5821
+ if (/^[ \t]/.test(ln) && unfolded.length)
5822
+ unfolded[unfolded.length - 1] += " " + ln.trim();
5823
+ else
5824
+ unfolded.push(ln);
5825
+ }
5826
+ const firstHeader = (name) => {
5827
+ const re = new RegExp("^" + name + ":\\s*(.*)$", "i");
5828
+ for (const ln of unfolded) {
5829
+ const m = ln.match(re);
5830
+ if (m)
5831
+ return m[1].trim();
5832
+ }
5833
+ return "";
5834
+ };
5835
+ deliveredTo = firstHeader("Delivered-To");
5836
+ returnPath = firstHeader("Return-Path").replace(/[<>]/g, "");
5837
+ listUnsubscribe = firstHeader("List-Unsubscribe");
5816
5838
  }
5817
5839
  const allowList = await loadAllowlist();
5818
5840
  const senderAddr = (envelope.from?.address || "").toLowerCase();
@@ -5836,9 +5858,9 @@ var WebMailxService = class {
5836
5858
  hasRemoteContent,
5837
5859
  remoteAllowed: allowRemote,
5838
5860
  attachments,
5839
- deliveredTo: "",
5840
- returnPath: "",
5841
- listUnsubscribe: "",
5861
+ deliveredTo,
5862
+ returnPath,
5863
+ listUnsubscribe,
5842
5864
  isFlagged
5843
5865
  };
5844
5866
  }