Skip to content

Commit 2c815d9

Browse files
committed
nette/mail 4.1.2
1 parent b01efb4 commit 2c815d9

2 files changed

Lines changed: 56 additions & 0 deletions

File tree

mail/cs/@home.texy

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,34 @@ $mailer->send($mail);
310310
Jako další parametry v konstruktoru můžeme uvést počet opakování a čekací dobu v milisekundách.
311311

312312

313+
Ladění e-mailů .{data-version:4.1.2}
314+
====================================
315+
316+
Při vývoji nebo na staging serveru nechcete, aby se nějaký testovací e-mail náhodou dostal k reálnému zákazníkovi. Existují dva způsoby, jak tomu zabránit.
317+
318+
Pro lokální vývoj doporučujeme spustit u sebe lehký SMTP zachytávač jako "Mailpit":https://mailpit.axllent.org nebo "MailHog":https://github.com/mailhog/MailHog. Přijmou každou zprávu, ukáží ji ve webovém UI a nikdy nic nepředají dál – Nette Mailu jen nastavíte `127.0.0.1:1025`:
319+
320+
```neon
321+
mail:
322+
smtp: true
323+
host: 127.0.0.1
324+
port: 1025
325+
```
326+
327+
Pro staging nebo prostředí, kde lokální zachytávač spustit nejde, má Nette Mail vestavěný redirect. Nastavte cílovou adresu v konfiguraci a každý příjemce v `To`, `Cc` i `Bcc` bude nahrazen touto adresou. Nette Mail uloží originály do hlaviček `X-Original-*`, takže pořád vidíte, komu měl e-mail dorazit, a do předmětu lze přidat značku:
328+
329+
```neon
330+
mail:
331+
redirect:
332+
to: dev@example.com
333+
subjectPrefix: '[debug]' # volitelný
334+
```
335+
336+
Zkrácený zápis `redirect: dev@example.com` postačí, když nepotřebujete prefix v předmětu. V debug módu se automaticky připojí panel v [Tracy Baru |tracy:] s přehledem všech odeslaných e-mailů.
337+
338+
Interně tohle zajišťuje [api:Nette\Mail\Interceptor], který nabízí ještě událost `$onSent` pro vlastní listenery (audit log, metriky, …).
339+
340+
313341
DKIM
314342
====
315343

mail/en/@home.texy

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,34 @@ $mailer->send($mail);
310310
Other parameters in the constructor include the number of retries and the waiting time in milliseconds.
311311

312312

313+
Debugging Emails .{data-version:4.1.2}
314+
======================================
315+
316+
When developing or running a staging server, you don't want a test email to slip out to a real customer. There are two ways to make sure that never happens.
317+
318+
The recommended local setup is to run a lightweight SMTP catcher like "Mailpit":https://mailpit.axllent.org or "MailHog":https://github.com/mailhog/MailHog on your machine. They accept every message, show it in a web UI, and never forward anything – you just point Nette Mail at `127.0.0.1:1025`:
319+
320+
```neon
321+
mail:
322+
smtp: true
323+
host: 127.0.0.1
324+
port: 1025
325+
```
326+
327+
For staging or environments where you can't run a local catcher, Nette Mail has a built-in redirect. Set the destination in the configuration and every `To`, `Cc`, and `Bcc` recipient is replaced with it. Nette Mail preserves the originals in `X-Original-*` headers so you can see who the email was meant for, and you can prepend a marker to the subject:
328+
329+
```neon
330+
mail:
331+
redirect:
332+
to: dev@example.com
333+
subjectPrefix: '[debug]' # optional
334+
```
335+
336+
The shortcut form `redirect: dev@example.com` works when you don't need a subject prefix. In debug mode, a [Tracy Bar |tracy:] panel listing all sent emails attaches automatically.
337+
338+
Internally this is handled by [api:Nette\Mail\Interceptor], which also exposes an `$onSent` event for custom listeners (audit logs, metrics, …).
339+
340+
313341
DKIM
314342
====
315343

0 commit comments

Comments
 (0)