@bobfrankston/rmfmail 1.1.190 → 1.1.192

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.
package/client/app.js CHANGED
@@ -893,6 +893,20 @@ async function openCompose(mode, overrideMsg, overrideAccountId) {
893
893
  const identityDomains = foldDomains(explicitDomains.length > 0
894
894
  ? explicitDomains
895
895
  : (accountDomain ? [accountDomain] : []));
896
+ // Extract the bare email address from a header value that may be a full
897
+ // `"Display Name" <addr@host>` form. detectReplyFrom must return a BARE
898
+ // address because the compose side wraps it as `${accountName} <${addr}>`
899
+ // — passing a full name+addr there produced the nested garbage
900
+ // `Bob Frankston <"mailing list" <multicians@groups.io>>` (Bob 2026-05-28).
901
+ // Delivered-To on mailing-list mail commonly carries a display name.
902
+ function bareAddress(raw) {
903
+ if (!raw)
904
+ return raw;
905
+ const angle = raw.match(/<([^>]+)>/);
906
+ if (angle)
907
+ return angle[1].trim();
908
+ return raw.trim().replace(/^"+|"+$/g, "");
909
+ }
896
910
  function detectReplyFrom() {
897
911
  if (!msg)
898
912
  return undefined;
@@ -902,15 +916,16 @@ async function openCompose(mode, overrideMsg, overrideAccountId) {
902
916
  // when their domain matches the account's identityDomains, since To/Cc
903
917
  // can be set by the sender and aren't authoritative.
904
918
  if (msg.deliveredTo) {
905
- console.log(`[compose] reply From → ${msg.deliveredTo} (Delivered-To)`);
906
- return msg.deliveredTo;
919
+ const addr = bareAddress(msg.deliveredTo);
920
+ console.log(`[compose] reply From → ${addr} (Delivered-To, bare of "${msg.deliveredTo}")`);
921
+ return addr;
907
922
  }
908
923
  if (identityDomains.length === 0)
909
924
  return undefined;
910
925
  const candidates = [
911
926
  ...((msg.to || []).map((a) => a.address)),
912
927
  ...((msg.cc || []).map((a) => a.address)),
913
- ].filter(Boolean);
928
+ ].filter(Boolean).map(bareAddress);
914
929
  for (const addr of candidates) {
915
930
  const domain = addr.split("@")[1]?.toLowerCase();
916
931
  if (domain && identityDomains.some(d => domain === d || domain.endsWith(`.${d}`))) {