Skip to content

Commit

Permalink
mail: configuring moved to @home
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed May 30, 2022
1 parent e69362e commit ceec750
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 88 deletions.
2 changes: 1 addition & 1 deletion doc/cs/configuring.texy
Expand Up @@ -18,7 +18,7 @@ Pokud používate celý framework, konfigurace se [načte při zavádění aplik
"http .[prism-token prism-atrule]":[http/configuration#HTTP hlavičky]: "HTTP hlavičky .[prism-token prism-comment]"<br>
"includes .[prism-token prism-atrule]":[dependency-injection/configuration#Vkládání souborů]: "Vkládání souborů .[prism-token prism-comment]"<br>
"latte .[prism-token prism-atrule]":[application/configuration#Šablony Latte]: "Šablony Latte .[prism-token prism-comment]"<br>
"mail .[prism-token prism-atrule]":[mail/configuration]: "Maily .[prism-token prism-comment]"<br>
"mail .[prism-token prism-atrule]":[mail/@home#Konfigurace]: "Maily .[prism-token prism-comment]"<br>
"parameters .[prism-token prism-atrule]":[dependency-injection/configuration#parametry]: "Parametry .[prism-token prism-comment]"<br>
"php .[prism-token prism-atrule]":[application/configuration#Php]: "PHP konfigurace .[prism-token prism-comment]"<br>
"routing .[prism-token prism-atrule]":[application/configuration#Routování]: "Routování .[prism-token prism-comment]"<br>
Expand Down
41 changes: 39 additions & 2 deletions doc/cs/mail/@home.texy
Expand Up @@ -189,7 +189,7 @@ Odeslání e-mailu

Mailer je třída zajišťující odesílání e-mailů. Implementuje rozhraní [api:Nette\Mail\Mailer] a k dispozici je několik předpřipravených mailerů, které si představíme.

Framework automaticky přidává do DI kontejneru službu typu `Nette\Mail\Mailer` sestavenou na základě [konfigurace|configuration], a ke které se dostanete tak, že si ji necháte předat pomocí [dependency injection |/dependency-injection/passing-dependencies].
Framework automaticky přidává do DI kontejneru službu typu `Nette\Mail\Mailer` sestavenou na základě [#konfigurace], a ke které se dostanete tak, že si ji necháte předat pomocí [dependency injection |/dependency-injection/passing-dependencies].


SendmailMailer
Expand Down Expand Up @@ -252,7 +252,7 @@ DKIM
DKIM (DomainKeys Identified Mail) je technologie pro zvýšení důvěryhodnosti e-mailů, která také napomáhá odhalení podvržených zpráv. Odeslaná zpráva je podepsána privátním klíčem domény odesílatele a tento podpis je uložen v hlavičce e-mailu.
Server příjemce porovná tento podpis s veřejným klíčem uloženým v DNS záznamech domény. Tím, že podpis odpovídá, je prokázáno, že e-mail skutečně pochází z odesílatelovy domény a že během přenosu zprávy nedošlo k její úpravě.

Podepisování e-mailů můžete maileru nastavit přímo v [konfiguraci|configuration]. Pokud nepoužíváte dependency injection, používá se tímto způsobem:
Podepisování e-mailů můžete maileru nastavit přímo v [#konfiguraci|Konfigurace]. Pokud nepoužíváte dependency injection, používá se tímto způsobem:

```php
$options = [
Expand All @@ -268,5 +268,42 @@ $mailer->send($mail);
```


Konfigurace
===========

Přehled konfiguračních voleb pro Nette Mail. Pokud nepoužívate celý framework, ale jen tuto knihovnu, přečtěte si, [jak konfiguraci načíst|/best-practices/how-to-load-configuration].

Pro odesílání e-mailů se standardně používá mailer `Nette\Mail\SendmailMailer`, který se dále nekonfiguruje. Můžeme jej však přepnout na `Nette\Mail\SmtpMailer`:

```neon
mail:
# použije SmtpMailer
smtp: true # (bool) výchozí je false
host: ... # (string)
port: ... # (int)
username: ... # (string)
password: ... # (string)
timeout: ... # (int)
secure: ... # (ssl|tls|null) výchozí je null
clientHost: ... # (string) výchozí je $_SERVER['HTTP_HOST']
persistent: ... # (bool) výchozí je false
# kontext pro připojení k SMTP serveru, viz stream_context_create()
context: # (array) výchozí je stream_context_get_default()
```

Pro zvýšení důvěryhodnosti můžeme e-maily podpisovat pomocí [technologie DKIM |https://blog.nette.org/cs/podepisujte-emaily-pomoci-dkim]:

```neon
mail:
dkim:
domain: myweb.com
selector: lovenette
privateKey: %appDir%/cert/dkim.priv
passPhrase: ...
```


{{composer: nette/mail}}
{{leftbar: /@menu-topics}}
41 changes: 0 additions & 41 deletions doc/cs/mail/configuration.texy

This file was deleted.

2 changes: 1 addition & 1 deletion doc/en/configuring.texy
Expand Up @@ -18,7 +18,7 @@ If you are using the full framework, the configuration will be [loaded during bo
"http .[prism-token prism-atrule]":[http/configuration#HTTP Headers]: "HTTP Headers .[prism-token prism-comment]"<br>
"includes .[prism-token prism-atrule]":[dependency-injection/configuration#Including files]: "Including files .[prism-token prism-comment]"<br>
"latte .[prism-token prism-atrule]":[application/configuration#Latte]: "Latte .[prism-token prism-comment]"<br>
"mail .[prism-token prism-atrule]":[mail/configuration]: "Mailing .[prism-token prism-comment]"<br>
"mail .[prism-token prism-atrule]":[mail/@home#Configuring]: "Mailing .[prism-token prism-comment]"<br>
"parameters .[prism-token prism-atrule]":[dependency-injection/configuration#Parameters]: "Parameters .[prism-token prism-comment]"<br>
"php .[prism-token prism-atrule]":[application/configuration#PHP]: "PHP configuration options .[prism-token prism-comment]"<br>
"routing .[prism-token prism-atrule]":[application/configuration#Routing]: "Routing .[prism-token prism-comment]"<br>
Expand Down
41 changes: 39 additions & 2 deletions doc/en/mail/@home.texy
Expand Up @@ -189,7 +189,7 @@ Sending Emails

Mailer is class responsible for sending emails. It implements the [api:Nette\Mail\Mailer] interface and several ready-made mailers are available which we will introduce.

The framework automatically adds a `Nette\Mail\Mailer` service based on [configuration] to the DI container, which you get by passing it using [dependency injection |/dependency-injection/passing-dependencies].
The framework automatically adds a `Nette\Mail\Mailer` service based on [#configuration|Configuring] to the DI container, which you get by passing it using [dependency injection |/dependency-injection/passing-dependencies].


SendmailMailer
Expand Down Expand Up @@ -252,7 +252,7 @@ DKIM
DKIM (DomainKeys Identified Mail) is a trustworthy email technology that also helps detect spoofed messages. The sent message is signed with the private key of the sender's domain and this signature is stored in the email header.
The recipient's server compares this signature with the public key stored in the domain's DNS records. By matching the signature, it is shown that the email actually originated from the sender's domain and that the message was not modified during the transmission of the message.

You can set up mailer to sign email in [configuration]. If you do not use dependency injection, it is used as follows:
You can set up mailer to sign email in [#configuration|Configuring]. If you do not use dependency injection, it is used as follows:

```php
$options = [
Expand All @@ -268,5 +268,42 @@ $mailer->send($mail);
```


Configuring
===========

Overview of configuration options for the Nette Mail. If you are not using the whole framework, but only this library, read [how to load the configuration|/best-practices/how-to-load-configuration].

By default, the mailer `Nette\Mail\SendmailMailer` is used to send emails, which is not further configured. However, we can switch it to `Nette\Mail\SmtpMailer`:

```neon
mail:
# use SmtpMailer
smtp: true # (bool) defaults to false
host: ... # (string)
port: ... # (int)
username: ... # (string)
password: ... # (string)
timeout: ... # (int)
secure: ... # (ssl|tls|null) defaults to null
clientHost: ... # (string) defaults to $_SERVER['HTTP_HOST']
persistent: ... # (bool) defaults to false
# context for connecting to the SMTP server, see stream_context_create()
context: # (array) defaults to stream_context_get_default()
```

To increase trustfulness, we can sign emails using [DKIM technology |https://blog.nette.org/en/sign-emails-with-dkim]:

```neon
mail:
dkim:
domain: myweb.com
selector: lovenette
privateKey: %appDir%/cert/dkim.priv
passPhrase: ...
```


{{composer: nette/mail}}
{{leftbar: /@menu-topics}}
41 changes: 0 additions & 41 deletions doc/en/mail/configuration.texy

This file was deleted.

0 comments on commit ceec750

Please sign in to comment.