Skip to content

Commit

Permalink
Minor update lmc-mail docs to correct typos
Browse files Browse the repository at this point in the history
  • Loading branch information
visto9259 committed Apr 10, 2024
1 parent 37b867f commit 8e81bf2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
5 changes: 4 additions & 1 deletion docs/lmc-mail/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ return [
],
];
```
In a development environment, it is typical to use a File Mail Transport. In a production environment, an SMTP Mail Transport will more likely be used.
In a production environment, an SMTP Mail Transport will more likely be used.

In a development environment, it is typical to use a File Mail Transport to write message to files to validate the
rendered output.

The `'transport'` configuration must comply with the `Laminas\Mail\Transport\Factory\Factory::create` method.

Expand Down
5 changes: 3 additions & 2 deletions docs/lmc-mail/Introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
sidebar_position: 1
---

LmcMail is an email service module that provides the ability to use the View renderer of a Laminas MVC application
LmcMail is an email service module that provides the ability to use the View Manager of a Laminas MVC application
and the installed View Helper plugins to render HTML emails.


## Requirements

- PHP 8.1 or higher
- Laminas MVC
- Laminas View
- Laminas Mail
4 changes: 2 additions & 2 deletions docs/lmc-mail/Usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $messageService = $serviceManager->get(LmcMail\Service\MessageService::class);

Basic example to send an HTML email:

````php
```php
$viewModel = new \Laminas\View\Model\ViewModel();
$viewModel->setTemplate('mail/html');
$message = $messageService->createHtmlMessage(
Expand All @@ -19,7 +19,7 @@ $message = $messageService->createHtmlMessage(
$viewModel); // View model

$messageService->send($message);
````
```

The `'mail/html'` template must exist in the application's view template map. The HTML mail renderer will use
a layout template aliased as `'mail/layout'` in the view template map. This is defined in the `module.config.php` file.
Expand Down
20 changes: 14 additions & 6 deletions docs/lmc-mail/advanced-customization.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
sidebar_position: 5
title: Advanced Configuration
---
LmcMail can be customized to the applications needs.

Expand All @@ -8,18 +9,24 @@ LmcMail can be customized to the applications needs.
LmcMail uses nested view models to render the body of HTML messages.

In a similar fashion to the view model structure of the Laminas MVC Skeleton,
the body is rendered using a layout view model to which the view model parameter (`$nameOrModel`) to the `createHtmlMessage` method is added a child.
the body is rendered using a layout view model to which the view model parameter (`$nameOrModel`) to the
`createHtmlMessage` method is added a child.
The rendered output of the `$nameOrModel` view model is captured in the variable `message` which is passed to the layout view model.

A default template `mail/layout` is supplied is `view/layout/layout.phtml`. This template can be the starting point for your own layout template.
A default template `'mail/layout'` is supplied in `lm-commons/lmc-mail/view/layout/layout.phtml`. This template can be
the starting point for your own layout template.
The layout template can be set using the `setLayoutTemplate()` method. Alternatively,
the `mail/layout` entry in the View Manager template map can be overridden to point to your template. Another alternative is to use a factory delegator to the `MessageServiceFactory::class` to set the layout template after the Message Service is created.
the `'mail/layout'` entry in the View Manager template map can be overridden to point to your template. Another
alternative is to use a factory delegator to the `MessageServiceFactory::class` to set the layout template after the
Message Service is created.

View Helpers can be used when rendering view models. A common use case is to use `$this->url()` to render a link to your application.
View Helpers can be used when rendering view models. A common use case is to use `$this->url()` to render a link to your
application.

#### Use alternate View Resolved and View Helper Manager

LmcMail uses Service Manager aliases to get the View Resolver and View Helper Manager which resolves to the Laminas MVC resolver and manager. This allows to use any view template and helpers already defined in the application.
LmcMail uses Service Manager aliases to get the View Resolver and View Helper Manager which resolves to the
Laminas MVC View resolver and manager. This allows to use any view template and helpers already defined in the application.

````php
'aliases' => [
Expand Down Expand Up @@ -54,7 +61,8 @@ If you want to use your own renderer, then you can override the Service Manager
- `MessageEvent::SEND` is triggered right before the message is sent by the transport service.
- `MessageEvent::SEND_POST` is triggered right after the message has been sent by the transport service.

The listener to these events will receive an event of class`MessageEvent` that extends the `Event` class with:
A listener to these events will receive an event of class `LmcMail\Service\MessageEvent` that extends the `\Laminas\EventManager\Event`
class with:

- A `$message` property containing the message. The message is also stored in an event parameter named 'message'.
- A `getMessage()` method to get the `$message` property.
Expand Down

0 comments on commit 8e81bf2

Please sign in to comment.