Skip to content

Commit 56f00c5

Browse files
w3romansamdark
authored andcommitted
Cosmetic changes and typos (yiisoft#12404) [skip ci]
1 parent 75439d3 commit 56f00c5

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

Diff for: docs/guide/tutorial-mailing.md

+12-13
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ return [
3232
Basic usage
3333
-----------
3434

35-
Once the 'mailer' component is configured, you can use the following code to send an email message:
35+
Once the `mailer` component is configured, you can use the following code to send an email message:
3636

3737
```php
3838
Yii::$app->mailer->compose()
@@ -50,18 +50,18 @@ You may put more complex logic in this process if needed:
5050
```php
5151
$message = Yii::$app->mailer->compose();
5252
if (Yii::$app->user->isGuest) {
53-
$message->setFrom('[email protected]')
53+
$message->setFrom('[email protected]');
5454
} else {
55-
$message->setFrom(Yii::$app->user->identity->email)
55+
$message->setFrom(Yii::$app->user->identity->email);
5656
}
5757
$message->setTo(Yii::$app->params['adminEmail'])
5858
->setSubject('Message subject')
5959
->setTextBody('Plain text content')
6060
->send();
6161
```
6262

63-
> Note: each 'mailer' extension comes in 2 major classes: 'Mailer' and 'Message'. 'Mailer' always knows
64-
the class name and specific of the 'Message'. Do not attempt to instantiate 'Message' object directly -
63+
> Note: each `mailer` extension comes in 2 major classes: `Mailer` and `Message`. `Mailer` always knows
64+
the class name and specific of the `Message`. Do not attempt to instantiate `Message` object directly
6565
always use `compose()` method for it.
6666

6767
You may also send several messages at once:
@@ -83,7 +83,7 @@ Composing mail content
8383
----------------------
8484

8585
Yii allows composition of the actual mail messages content via special view files.
86-
By default these files should be located at '@app/mail' path.
86+
By default these files should be located at `@app/mail` path.
8787

8888
Example mail view file content:
8989

@@ -92,7 +92,6 @@ Example mail view file content:
9292
use yii\helpers\Html;
9393
use yii\helpers\Url;
9494

95-
9695
/* @var $this \yii\web\View view component instance */
9796
/* @var $message \yii\mail\BaseMessage instance of newly created mail message */
9897

@@ -175,10 +174,10 @@ You can add attachments to message using methods `attach()` and `attachContent()
175174
```php
176175
$message = Yii::$app->mailer->compose();
177176

178-
// Attach file from local file system:
177+
// attach file from local file system
179178
$message->attach('/path/to/source/file.pdf');
180179

181-
// Create attachment on-the-fly
180+
// create attachment on-the-fly
182181
$message->attachContent('Attachment content', ['fileName' => 'attach.txt', 'contentType' => 'text/plain']);
183182
```
184183

@@ -187,7 +186,7 @@ Embedding images
187186
----------------
188187

189188
You can embed images into the message content using `embed()` method. This method returns the attachment id,
190-
which should be then used at 'img' tag.
189+
which should be then used at `img` tag.
191190
This method is easy to use when composing message content via view file:
192191

193192
```php
@@ -209,7 +208,7 @@ Testing and debugging
209208
A developer often has to check, what actual emails are sent by the application, what was their content and so on.
210209
Such ability is granted by Yii via `yii\mail\BaseMailer::useFileTransport`. If enabled, this option enforces
211210
saving mail message data into the local files instead of regular sending. These files will be saved under
212-
`yii\mail\BaseMailer::fileTransportPath`, which is '@runtime/mail' by default.
211+
`yii\mail\BaseMailer::fileTransportPath`, which is `@runtime/mail` by default.
213212

214213
> Note: you can either save the messages to the files or send them to the actual recipients, but can not do both simultaneously.
215214
@@ -223,8 +222,8 @@ This mechanism may prove itself, while debugging application or running unit tes
223222
Creating your own mail solution
224223
-------------------------------
225224

226-
In order to create your own custom mail solution, you need to create 2 classes: one for the 'Mailer' and
227-
another one for the 'Message'.
225+
In order to create your own custom mail solution, you need to create 2 classes: one for the `Mailer` and
226+
another one for the `Message`.
228227
You can use `yii\mail\BaseMailer` and `yii\mail\BaseMessage` as the base classes for your solution. These classes
229228
already contain the basic logic, which is described in this guide. However, their usage is not mandatory, it is enough
230229
to implement `yii\mail\MailerInterface` and `yii\mail\MessageInterface` interfaces.

0 commit comments

Comments
 (0)