Skip to content

Commit

Permalink
readme: updated
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Nov 29, 2023
1 parent 34639bf commit e11dafa
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Images can also be extremely easily inserted into the HTML body of an email. Jus
// automatically adds /path/to/images/background.gif to the email
$mail->setHtmlBody(
'<b>Hello</b> <img src="background.gif">',
'/path/to/images'
'/path/to/images',
);
```

Expand Down Expand Up @@ -118,14 +118,14 @@ $mail = new Nette\Mail\Message;
$mail->setFrom('John <john@example.com>')
->addTo('[email protected]')
->setHtmlBody(
$latte->renderToString('email.latte', $params),
'/path/to/images'
$latte->renderToString('/path/to/email.latte', $params),
'/path/to/images',
);
```

File `email.latte`:

```html
```latte
<html>
<head>
<meta charset="utf-8">
Expand Down Expand Up @@ -174,22 +174,22 @@ SmtpMailer
To send mail via the SMTP server, use `SmtpMailer`.

```php
$mailer = new Nette\Mail\SmtpMailer([
'host' => 'smtp.gmail.com',
'username' => '[email protected]',
'password' => '*****',
'secure' => 'ssl',
]);
$mailer = new Nette\Mail\SmtpMailer(
host: 'smtp.gmail.com',
username: '[email protected]',
password: '*****',
encryption: Nette\Mail\SmtpMailer::EncryptionSSL,
);
$mailer->send($mail);
```

If you do not specify `host`, the value from php.ini will be used. The following additional keys can be used in the options:
The following additional parameters can be passed to the constructor:

* `port` - if not set, the default 25 or 465 for `ssl` will be used
* `context` - allows you to set [SSL context options](https://www.php.net/manual/en/context.ssl.php) for connection
* `timeout` - timeout for SMTP connection
* `persistent` - use persistent connection
* `clientHost` - client designation
* `streamOptions` - allows you to set [SSL context options](https://www.php.net/manual/en/context.ssl.php) for connection


FallbackMailer
Expand All @@ -201,7 +201,7 @@ It does not send email but sends them through a set of mailers. If one mailer fa
$mailer = new Nette\Mail\FallbackMailer([
$smtpMailer,
$backupSmtpMailer,
$sendmailMailer
$sendmailMailer,
]);
$mailer->send($mail);
```
Expand All @@ -216,14 +216,14 @@ DKIM (DomainKeys Identified Mail) is a trustworthy email technology that also he
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.

```php
$options = [
'domain' => 'nette.org',
'selector' => 'dkim',
'privateKey' => file_get_contents('../dkim/dkim.key'),
'passPhrase' => '****',
];
$signer = new Nette\Mail\DkimSigner(
domain: 'nette.org',
selector: 'dkim',
privateKey: file_get_contents('../dkim/dkim.key'),
passPhrase: '****',
);

$mailer = new Nette\Mail\SendmailMailer; // or SmtpMailer
$mailer->setSigner(new Nette\Mail\DkimSigner($options));
$mailer->setSigner($signer);
$mailer->send($mail);
```

0 comments on commit e11dafa

Please sign in to comment.