Skip to content

Commit

Permalink
fix: added "headers" and "bounced_at" to bounce webhook, updated FAQ …
Browse files Browse the repository at this point in the history
…and API docs, added missing Iconv in new Headers invocation in message splitter class
  • Loading branch information
titanism committed Aug 24, 2024
1 parent 7c82cb3 commit 2dfc1e0
Show file tree
Hide file tree
Showing 36 changed files with 341 additions and 42 deletions.
1 change: 1 addition & 0 deletions app/controllers/web/admin/domains.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ async function list(ctx) {
ctx.body = { table };
}

// eslint-disable-next-line complexity
async function update(ctx) {
const domain = await Domains.findById(ctx.params.id);

Expand Down
11 changes: 10 additions & 1 deletion app/views/_footer.pug
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,16 @@ footer.mt-auto(aria-label=t("Footer"))
ul.list-unstyled.mb-0.mb-lg-3
li: a.d-block.text-white.py-2.py-md-0(href=l("/ips"))= t("IP Addresses")
li: a.d-block.text-white.py-2.py-md-0(href=l("/email-api"))= t("Email API Reference")
li: a.d-block.text-white.py-2.py-md-0(href=l("/free-email-webhooks"))= t("Free Email Webhooks")
li: a.d-block.text-white.py-2.py-md-0(
href=isBot(ctx.get("User-Agent")) ? l("/free-email-webhooks") : l("/faq#do-you-support-webhooks")
)
if isBot(ctx.get("User-Agent"))
= t("Free Email Webhooks")
else
= t("Email Webhooks")
li: a.d-block.text-white.py-2.py-md-0(
href=l("/faq#do-you-support-bounce-webhooks")
)= t("Bounce Webhooks")
li: a.d-block.text-white.py-2.py-md-0(
href=l("/email-forwarding-regex-pattern-filter")
)= t("Regex Email Forwarding")
Expand Down
16 changes: 13 additions & 3 deletions app/views/_nav.pug
Original file line number Diff line number Diff line change
Expand Up @@ -589,11 +589,21 @@ nav.navbar(class=navbarClasses.join(" "))
a.dropdown-item(
href=l("/email-api"),
class=ctx.pathWithoutLocale === "/email-api" ? "active" : ""
)= t("Email API Reference")
)
if isBot(ctx.get("User-Agent"))
= t("Email API Reference")
else
= t("API Reference")
a.dropdown-item(
href=l("/free-email-webhooks"),
href=isBot(ctx.get("User-Agent")) ? l("/free-email-webhooks") : l("/faq#do-you-support-webhooks"),
class=ctx.pathWithoutLocale === "/free-email-webhooks" ? "active" : ""
)= t("Free Email Webhooks")
)
if isBot(ctx.get("User-Agent"))
= t("Free Email Webhooks")
else
= t("Email Webhooks")
a.dropdown-item(href=l("/faq#do-you-support-bounce-webhooks"))
= t("Bounce Webhooks")
a.dropdown-item(
href=l("/email-forwarding-regex-pattern-filter"),
class=ctx.pathWithoutLocale === "/email-forwarding-regex-pattern-filter" ? "active" : ""
Expand Down
26 changes: 25 additions & 1 deletion app/views/faq/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2758,6 +2758,16 @@ Note that if you upgrade or downgrade between paid plans within a 30-day window

## Do you support bounce webhooks

<div class="alert my-3 alert-primary">
<i class="fa fa-info-circle font-weight-bold"></i>
<strong class="font-weight-bold">
Tip:
</strong>
Looking for documentation on email webhooks? See <a href="/faq#do-you-support-webhooks">Do you support webhooks?</a> for more insight.
<span>
</span>
</div>

Yes, as of August 14, 2024 we have added this feature. You can now go to My Account → Domains → Settings → Bounce Webhook URL and configure an `http://` or `https://` URL that we will send a `POST` request to whenever outbound SMTP emails bounce.

This is useful for you to manage and monitor your outbound SMTP – and can be used to maintain subscribers, opt-out, and detect whenever bounces occur.
Expand All @@ -2780,6 +2790,8 @@ Bounce webhook payloads are sent as a JSON with these properties:
* `code` (Number) - bounce status code (e.g. `554`)
* `status` (String) - bounce code from response message (e.g. `5.7.1`)
* `line` (Number) - parsed line number, if any, [from Zone-MTA bounce parse list](https://github.com/zone-eu/zone-mta/blob/master/config/bounces.txt) (e.g. `526`)
* `headers` (Object) - key value pair of headers for the outbound email
* `bounced_at` (String) - [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) formatted Date for when the bounce error occurred

For example:

Expand All @@ -2798,7 +2810,9 @@ For example:
"code": 552,
"status": "5.2.2",
"line": 300
}
},
"headers": {},
"bounced_at": "2024-08-24T01:50:02.828Z"
}
```

Expand All @@ -2818,6 +2832,16 @@ Here are a few additional notes regarding bounce webhooks:

## Do you support webhooks

<div class="alert my-3 alert-primary">
<i class="fa fa-info-circle font-weight-bold"></i>
<strong class="font-weight-bold">
Tip:
</strong>
Looking for documentation on bounce webhooks? See <a href="/faq#do-you-support-bounce-webhooks">Do you support bounce webhooks?</a> for more insight.
<span>
</span>
</div>

Yes, as of May 15, 2020 we have added this feature. You can simply add webhook(s) exactly like you would with any recipient! Please ensure that you have the "http" or "https" protocol prefixed in the webhook's URL.

<div class="alert my-3 alert-danger">
Expand Down
Binary file modified assets/img/alternatives/forward-email.webp
Binary file not shown.
2 changes: 1 addition & 1 deletion helpers/message-splitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class MessageSplitter extends Transform {
// join all chunks into a header block
this.rawHeaders = Buffer.concat(this.headerChunks, this.headerBytes);

this.headers = new Headers(this.rawHeaders);
this.headers = new Headers(this.rawHeaders, { Iconv });

// this.emit('headers', this.headers);
this.headerChunks = null;
Expand Down
7 changes: 6 additions & 1 deletion helpers/process-email.js
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,12 @@ async function processEmail({ email, port = 25, resolver, client }) {
response: error.response,
response_code: error.responseCode,
truth_source: error.truthSource,
bounce: getBounceInfo(error)
bounce: getBounceInfo(error),
headers: email.headers,
bounced_at:
typeof error.date !== 'undefined' && _.isDate(new Date(error.date))
? new Date(error.date).toISOString()
: new Date().toISOString()
});
// dummyproofing
const url = domain.bounce_webhook
Expand Down
12 changes: 11 additions & 1 deletion locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -10285,5 +10285,15 @@
"The value <span class=\"notranslate\">%s</span> was listed in our permanent and hard-coded denylist. Our team has been notified of your request for removal and we will follow up soon.": "تم إدراج القيمة <span class=\"notranslate\">%s</span> في قائمة الرفض الدائمة والمبرمجة لدينا. لقد تم إخطار فريقنا بطلب الإزالة وسنتابع الأمر قريبًا.",
"<span class=\"notranslate\">%s</span> approved for NEWSLETTER access": "تمت الموافقة على <span class=\"notranslate\">%s</span> للوصول إلى النشرة الإخبارية",
"<p class=\"text-center\">Your domain <span class=\"notranslate\">%s</span> was approved for NEWSLETTER access.</p><p class=\"text-center mb-0\"><a class=\"btn btn-lg btn-danger\" href=\"%s\">Complete Setup</a></p>": "<p class=\"text-center\" style=\";text-align:right;direction:rtl\">تمت الموافقة على نطاقك <span class=\"notranslate\">%s</span> للوصول إلى النشرة الإخبارية.</p><p class=\"text-center mb-0\" style=\";text-align:right;direction:rtl\"> <a class=\"btn btn-lg btn-danger\" href=\"%s\">الإعداد الكامل</a></p>",
"<p class=\"text-center text-danger\">Your domain <span class=\"notranslate\">%s</span> had its NEWSLETTER access removed.</p>": "<p class=\"text-center text-danger\" style=\";text-align:right;direction:rtl\">لقد تم إزالة إمكانية الوصول إلى النشرة الإخبارية لنطاقك <span class=\"notranslate\">%s</span> .</p>"
"<p class=\"text-center text-danger\">Your domain <span class=\"notranslate\">%s</span> had its NEWSLETTER access removed.</p>": "<p class=\"text-center text-danger\" style=\";text-align:right;direction:rtl\">لقد تم إزالة إمكانية الوصول إلى النشرة الإخبارية لنطاقك <span class=\"notranslate\">%s</span> .</p>",
"Looking for documentation on email webhooks? See": "هل تبحث عن وثائق حول خطافات البريد الإلكتروني؟ راجع",
"Do you support webhooks?": "هل تدعمون webhooks؟",
"(Object) - key value pair of headers for the outbound email": "(الكائن) - زوج من القيم الرئيسية لرؤوس البريد الإلكتروني الصادر",
"(String) -": "(خيط) -",
"formatted Date for when the bounce error occurred": "تم تنسيق التاريخ الذي حدث فيه خطأ الارتداد",
"Looking for documentation on bounce webhooks? See": "هل تبحث عن وثائق حول خطافات الويب المرتدة؟ راجع",
"Do you support bounce webhooks?": "هل تدعم خطافات الويب المرتدة؟",
"API Reference": "مرجع واجهة برمجة التطبيقات",
"Email Webhooks": "خطافات البريد الإلكتروني",
"Bounce Webhooks": "خطافات الويب المرتدة"
}
12 changes: 11 additions & 1 deletion locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -10285,5 +10285,15 @@
"The value <span class=\"notranslate\">%s</span> was listed in our permanent and hard-coded denylist. Our team has been notified of your request for removal and we will follow up soon.": "Hodnota <span class=\"notranslate\">%s</span> byla uvedena v našem trvalém a pevně zakódovaném seznamu odmítnutých. Náš tým byl informován o vaší žádosti o odstranění a brzy se vám ozveme.",
"<span class=\"notranslate\">%s</span> approved for NEWSLETTER access": "<span class=\"notranslate\">%s</span> schválen pro přístup k NEWSLETTERU",
"<p class=\"text-center\">Your domain <span class=\"notranslate\">%s</span> was approved for NEWSLETTER access.</p><p class=\"text-center mb-0\"><a class=\"btn btn-lg btn-danger\" href=\"%s\">Complete Setup</a></p>": "<p class=\"text-center\">Přístup k vaší doméně <span class=\"notranslate\">%s</span> byl schválen pro NEWSLETTER.</p><p class=\"text-center mb-0\"> <a class=\"btn btn-lg btn-danger\" href=\"%s\">Dokončete nastavení</a></p>",
"<p class=\"text-center text-danger\">Your domain <span class=\"notranslate\">%s</span> had its NEWSLETTER access removed.</p>": "<p class=\"text-center text-danger\">Vaší doméně <span class=\"notranslate\">%s</span> byl odebrán přístup k NEWSLETTERU.</p>"
"<p class=\"text-center text-danger\">Your domain <span class=\"notranslate\">%s</span> had its NEWSLETTER access removed.</p>": "<p class=\"text-center text-danger\">Vaší doméně <span class=\"notranslate\">%s</span> byl odebrán přístup k NEWSLETTERU.</p>",
"Looking for documentation on email webhooks? See": "Hledáte dokumentaci k e-mailovým webhookům? Vidět",
"Do you support webhooks?": "Podporujete webhooky?",
"(Object) - key value pair of headers for the outbound email": "(Object) – dvojice klíčů a hodnot hlaviček pro odchozí e-maily",
"(String) -": "(řetězec) -",
"formatted Date for when the bounce error occurred": "formátováno Datum, kdy došlo k chybě bounce",
"Looking for documentation on bounce webhooks? See": "Hledáte dokumentaci o bounce webhoocích? Vidět",
"Do you support bounce webhooks?": "Podporujete bounce webhooky?",
"API Reference": "Reference API",
"Email Webhooks": "E-mailové webhooky",
"Bounce Webhooks": "Bounce webhooky"
}
12 changes: 11 additions & 1 deletion locales/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -7256,5 +7256,15 @@
"The value <span class=\"notranslate\">%s</span> was listed in our permanent and hard-coded denylist. Our team has been notified of your request for removal and we will follow up soon.": "Værdien <span class=\"notranslate\">%s</span> blev opført i vores permanente og hårdkodede afvisningsliste. Vores team er blevet underrettet om din anmodning om fjernelse, og vi vil snart følge op.",
"<span class=\"notranslate\">%s</span> approved for NEWSLETTER access": "<span class=\"notranslate\">%s</span> godkendt til NEWSLETTER-adgang",
"<p class=\"text-center\">Your domain <span class=\"notranslate\">%s</span> was approved for NEWSLETTER access.</p><p class=\"text-center mb-0\"><a class=\"btn btn-lg btn-danger\" href=\"%s\">Complete Setup</a></p>": "<p class=\"text-center\">Dit domæne <span class=\"notranslate\">%s</span> blev godkendt til NEWSLETTER-adgang.</p><p class=\"text-center mb-0\"> <a class=\"btn btn-lg btn-danger\" href=\"%s\">Fuldfør opsætning</a></p>",
"<p class=\"text-center text-danger\">Your domain <span class=\"notranslate\">%s</span> had its NEWSLETTER access removed.</p>": "<p class=\"text-center text-danger\">Dit domæne <span class=\"notranslate\">%s</span> fik fjernet sin NEWSLETTER-adgang.</p>"
"<p class=\"text-center text-danger\">Your domain <span class=\"notranslate\">%s</span> had its NEWSLETTER access removed.</p>": "<p class=\"text-center text-danger\">Dit domæne <span class=\"notranslate\">%s</span> fik fjernet sin NEWSLETTER-adgang.</p>",
"Looking for documentation on email webhooks? See": "Leder du efter dokumentation om e-mail webhooks? Se",
"Do you support webhooks?": "Understøtter du webhooks?",
"(Object) - key value pair of headers for the outbound email": "(Objekt) - nøgleværdipar af overskrifter for den udgående e-mail",
"(String) -": "(streng) -",
"formatted Date for when the bounce error occurred": "formateret Dato for hvornår afvisningsfejlen opstod",
"Looking for documentation on bounce webhooks? See": "Leder du efter dokumentation om bounce webhooks? Se",
"Do you support bounce webhooks?": "Understøtter du bounce webhooks?",
"API Reference": "API-reference",
"Email Webhooks": "E-mail Webhooks",
"Bounce Webhooks": "Bounce Webhooks"
}
12 changes: 11 additions & 1 deletion locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -9324,5 +9324,15 @@
"The value <span class=\"notranslate\">%s</span> was listed in our permanent and hard-coded denylist. Our team has been notified of your request for removal and we will follow up soon.": "Der Wert <span class=\"notranslate\">%s</span> wurde in unserer permanenten und fest codierten Sperrliste aufgeführt. Unser Team wurde über Ihre Entfernungsanfrage informiert und wir werden uns in Kürze darum kümmern.",
"<span class=\"notranslate\">%s</span> approved for NEWSLETTER access": "<span class=\"notranslate\">%s</span> für NEWSLETTER-Zugriff zugelassen",
"<p class=\"text-center\">Your domain <span class=\"notranslate\">%s</span> was approved for NEWSLETTER access.</p><p class=\"text-center mb-0\"><a class=\"btn btn-lg btn-danger\" href=\"%s\">Complete Setup</a></p>": "<p class=\"text-center\">Für Ihre Domäne <span class=\"notranslate\">%s</span> wurde der NEWSLETTER-Zugriff genehmigt.</p><p class=\"text-center mb-0\"> <a class=\"btn btn-lg btn-danger\" href=\"%s\">Vollständige Einrichtung</a></p>",
"<p class=\"text-center text-danger\">Your domain <span class=\"notranslate\">%s</span> had its NEWSLETTER access removed.</p>": "<p class=\"text-center text-danger\">Der NEWSLETTER-Zugriff Ihrer Domäne <span class=\"notranslate\">%s</span> wurde entfernt.</p>"
"<p class=\"text-center text-danger\">Your domain <span class=\"notranslate\">%s</span> had its NEWSLETTER access removed.</p>": "<p class=\"text-center text-danger\">Der NEWSLETTER-Zugriff Ihrer Domäne <span class=\"notranslate\">%s</span> wurde entfernt.</p>",
"Looking for documentation on email webhooks? See": "Suchen Sie nach Dokumentation zu E-Mail-Webhooks? Siehe",
"Do you support webhooks?": "Unterstützen Sie Webhooks?",
"(Object) - key value pair of headers for the outbound email": "(Objekt) - Schlüssel-Wert-Paar von Headern für die ausgehende E-Mail",
"(String) -": "(Zeichenfolge) -",
"formatted Date for when the bounce error occurred": "formatiertes Datum für den Zeitpunkt des Bounce-Fehlers",
"Looking for documentation on bounce webhooks? See": "Suchen Sie nach Dokumentation zu Bounce-Webhooks? Siehe",
"Do you support bounce webhooks?": "Unterstützen Sie Bounce-Webhooks?",
"API Reference": "API-Referenz",
"Email Webhooks": "E-Mail-Webhooks",
"Bounce Webhooks": "Bounce-Webhooks"
}
12 changes: 11 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -10012,5 +10012,15 @@
"Unlimited inbound email": "Unlimited inbound email",
"<span class=\"notranslate\">%s</span> attachment limit": "<span class=\"notranslate\">%s</span> attachment limit",
"For families, groups, and organizations": "For families, groups, and organizations",
"For <a href=\"%s\" class=\"text-themed font-weight-bold\">education</a>, <a href=\"%s\" class=\"text-themed font-weight-bold\">universities</a>, <a href=\"%s\" class=\"text-themed font-weight-bold\">alumni email forwarding</a>, <a href=\"%s\" class=\"text-themed font-weight-bold\">healthcare</a>, <a href=\"%s\" class=\"text-themed font-weight-bold\">government</a>, and custom implementations": "For <a href=\"%s\" class=\"text-themed font-weight-bold\">education</a>, <a href=\"%s\" class=\"text-themed font-weight-bold\">universities</a>, <a href=\"%s\" class=\"text-themed font-weight-bold\">alumni email forwarding</a>, <a href=\"%s\" class=\"text-themed font-weight-bold\">healthcare</a>, <a href=\"%s\" class=\"text-themed font-weight-bold\">government</a>, and custom implementations"
"For <a href=\"%s\" class=\"text-themed font-weight-bold\">education</a>, <a href=\"%s\" class=\"text-themed font-weight-bold\">universities</a>, <a href=\"%s\" class=\"text-themed font-weight-bold\">alumni email forwarding</a>, <a href=\"%s\" class=\"text-themed font-weight-bold\">healthcare</a>, <a href=\"%s\" class=\"text-themed font-weight-bold\">government</a>, and custom implementations": "For <a href=\"%s\" class=\"text-themed font-weight-bold\">education</a>, <a href=\"%s\" class=\"text-themed font-weight-bold\">universities</a>, <a href=\"%s\" class=\"text-themed font-weight-bold\">alumni email forwarding</a>, <a href=\"%s\" class=\"text-themed font-weight-bold\">healthcare</a>, <a href=\"%s\" class=\"text-themed font-weight-bold\">government</a>, and custom implementations",
"Looking for documentation on email webhooks? See": "Looking for documentation on email webhooks? See",
"Do you support webhooks?": "Do you support webhooks?",
"(Object) - key value pair of headers for the outbound email": "(Object) - key value pair of headers for the outbound email",
"(String) -": "(String) -",
"formatted Date for when the bounce error occurred": "formatted Date for when the bounce error occurred",
"Looking for documentation on bounce webhooks? See": "Looking for documentation on bounce webhooks? See",
"Do you support bounce webhooks?": "Do you support bounce webhooks?",
"API Reference": "API Reference",
"Email Webhooks": "Email Webhooks",
"Bounce Webhooks": "Bounce Webhooks"
}
Loading

0 comments on commit 2dfc1e0

Please sign in to comment.