diff --git a/inbound.js b/inbound.js index 204b8df..4f6e361 100644 --- a/inbound.js +++ b/inbound.js @@ -54,7 +54,10 @@ async function handle(buf, contentType) { if ((auto && !/^no$/i.test(auto)) || /bulk|junk|list/i.test(prec) || header(raw, 'X-Autoreply') || header(raw, 'X-Autorespond') || ROBOT_FROM.test(from)) return 'robot dropped: ' + from; if (/@(instantadpay\.com|help\.instantadpay\.com|linkspin\.app)$/.test(from)) return 'own address dropped'; if (flood(from)) return 'flood dropped: ' + from; - const platform = rcpts.some(r => /@linkspin\.app$/.test(r)) ? 'linkspin' : 'iap'; + // support@instantadpay.com is forwarded by NameSilo to iap-support@linkspin.app (its forwarder will not deliver to our own + // help. subdomain), so that one address means an InstantAdPay ticket even though it arrives on the LinkSpin host + const iapAlias = r => /^iap-support@linkspin\.app$/.test(r); + const platform = rcpts.some(r => /@linkspin\.app$/.test(r) && !iapAlias(r)) ? 'linkspin' : 'iap'; let subject = String(f.subject || '').replace(/\s+/g, ' ').trim(); const plus = rcpts.map(r => /^reply\+((?:iap|ls)-\d{4,9})@/.exec(r)).find(Boolean); // the reply-to we put on ticket mail if (plus) { const ref = plus[1].toUpperCase(); if (!subject.toUpperCase().includes(ref)) subject = '[' + ref + '] ' + subject; }