Skip to content

Commit b5ab919

Browse files
authored
Merge pull request #55 from Jurj-Bogdan/4.0
Added v4 documentation, updated workflows
2 parents 4c50a47 + 7f3f2e0 commit b5ab919

File tree

16 files changed

+300
-166
lines changed

16 files changed

+300
-166
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: "Continuous Integration"
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
tags:
8+
9+
jobs:
10+
ci:
11+
uses: laminas/workflow-continuous-integration/.github/workflows/continuous-integration.yml@1.x

.github/workflows/cs-tests.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/docs-build.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: docs-build
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Build Docs
13+
uses: dotkernel/documentation-theme/github-actions/docs@main
14+
env:
15+
DEPLOY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/static-analysis.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/unit-tests.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

README.md

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
DotKernel mail component based on [laminas-mail](https://github.com/laminas/laminas-mail)
44

5-
65
![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-mail)
76
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-mail/4.1.1)
87

@@ -11,15 +10,15 @@ DotKernel mail component based on [laminas-mail](https://github.com/laminas/lami
1110
[![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/stargazers)
1211
[![GitHub license](https://img.shields.io/github/license/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/blob/4.0/LICENSE.md)
1312

14-
[![Build Static](https://github.com/dotkernel/dot-mail/actions/workflows/static-analysis.yml/badge.svg?branch=4.0)](https://github.com/dotkernel/dot-mail/actions/workflows/static-analysis.yml)
13+
[![Build Static](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml/badge.svg?branch=4.0)](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml)
1514
[![codecov](https://codecov.io/gh/dotkernel/dot-mail/branch/4.0/graph/badge.svg?token=G51NEHYKD3)](https://codecov.io/gh/dotkernel/dot-mail)
1615

1716
[![SymfonyInsight](https://insight.symfony.com/projects/1995ea7c-3b34-4eee-ac48-3571860d0307/big.svg)](https://insight.symfony.com/projects/1995ea7c-3b34-4eee-ac48-3571860d0307)
1817

18+
## Configuration
1919

20-
### Configuration
20+
### Mail - Sendmail
2121

22-
#### Mail - Sendmail
2322
If your server has Sendmail installed, update the `config/autoload/mail.local.php.dist` file by setting the `transport` key like below
2423

2524
```php
@@ -35,13 +34,16 @@ return [
3534
]
3635
```
3736

38-
#### Mail - SMTP
37+
### Mail - SMTP
38+
3939
If you want your application to send mails on e.g. registration, contact, then edit the file `config/autoload/mail.local.php`. Set the `transport`, `message_options` and `smtp_options` keys like below.
4040

4141
Under `message_options` key:
42+
4243
- `from` - email address from whom users will receive emails
4344

4445
Under `smtp_options` key:
46+
4547
- `host` - the mail server's hostname or IP address
4648
- `port` - the mail server's port
4749
- `connection_config` - fill in the `username`, `password` and `ssl` keys with the login details of the email used in `from` above
@@ -113,6 +115,7 @@ try {
113115
```
114116

115117
### Testing if an e-mail message is valid
118+
116119
After sending an e-mail you can check if the message was valid or not.
117120
The `$this->mailService->send()->isValid()` method call will return a boolean value.
118121
If the returned result is `true`, the e-mail was valid, otherwise the e-mail was invalid.
@@ -121,24 +124,24 @@ In case your e-mail was invalid, you can check for any errors using `$this->mail
121124
Using the below logic will let you determine if a message was valid or not and log it.
122125
You can implement your own custom error logging logic.
123126

124-
````
127+
```php
125128
$result = $this->mailService->send();
126129
if (! $result->isValid()) {
127130
//log the error
128131
error_log($result->getMessage());
129132
}
130-
````
131-
**Note : Invalid e-mail messages will not be sent.**
133+
```
132134

135+
**Note : Invalid e-mail messages will not be sent.**
133136

134137
### Logging outgoing emails
138+
135139
Optionally, you can keep a log of each successfully sent email. This might be useful when you need to know if/when a specific email has been sent out to a recipient.
136140

137141
Logs are stored in the following format: `[YYYY-MM-DD HH:MM:SS]: {"subject":"Test subject","to":["Test Account <test@dotkernel.com>"],"cc":[],"bcc":[]}`.
138142

139-
By default, this feature is disabled.
140-
141143
In order to enable it, make sure that your `config/autoload/mail.local.php` has the below `log` configuration under the `dot_mail` key:
144+
142145
```php
143146
<?php
144147

@@ -151,11 +154,15 @@ return [
151154
]
152155
];
153156
```
154-
To disable it again, set the value of `sent` to `null`.
157+
158+
To disable it, set the value of `sent` to `null`.
155159

156160
### Saving a copy of an outgoing mail into a folder
157-
#### Valid only for SMTP Transport
161+
162+
### Valid only for SMTP Transport
163+
158164
First, make sure the `save_sent_message_folder` key is present in config file `mail.local.php` under `dot_mail.default`. Below you can see its placement and default value.
165+
159166
```php
160167
<?php
161168

@@ -168,6 +175,7 @@ return [
168175
],
169176
];
170177
```
178+
171179
Common folder names are `INBOX`, `INBOX.Archive`, `INBOX.Drafts`, `INBOX.Sent`, `INBOX.Spam`, `INBOX.Trash`. If you have `MailService` available in your class, you can call `$this->mailService->getFolderGlobalNames()` to list the folder global names for the email you are using.
172180

173181
Multiple folders can be added to the `save_sent_message_folder` key to save a copy of the outgoing email in each folder.

SECURITY.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
6+
| Version | Supported | PHP Version |
7+
|---------|--------------------|----------------------------------------------------------------------------------------------------------|
8+
| 4.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-mail/4.1.1) |
9+
| <= 3.x | :x: | |
10+
11+
12+
## Reporting Potential Security Issues
13+
14+
If you have encountered a potential security vulnerability in this project,
15+
please report it to us at <security@dotkernel.com>. We will work with you to
16+
verify the vulnerability and patch it.
17+
18+
When reporting issues, please provide the following information:
19+
20+
- Component(s) affected
21+
- A description indicating how to reproduce the issue
22+
- A summary of the security vulnerability and impact
23+
24+
We request that you contact us via the email address above and give the
25+
project contributors a chance to resolve the vulnerability and issue a new
26+
release prior to any public exposure; this helps protect the project's
27+
users, and provides them with a chance to upgrade and/or update in order to
28+
protect their applications.
29+
30+
31+
## Policy
32+
33+
If we verify a reported security vulnerability, our policy is:
34+
35+
- We will patch the current release branch, as well as the immediate prior minor
36+
release branch.
37+
38+
- After patching the release branches, we will immediately issue new security
39+
fix releases for each patched release branch.

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
3030
"ext-fileinfo": "*",
3131
"ext-json": "*",
32-
"laminas/laminas-servicemanager": "^3.22.1",
33-
"laminas/laminas-mail": "^2.25.1",
34-
"dotkernel/dot-event": "^3.4.2"
32+
"laminas/laminas-servicemanager": "^3.22",
33+
"laminas/laminas-mail": "^2.25",
34+
"dotkernel/dot-event": "^3.4"
3535
},
3636
"require-dev": {
37-
"laminas/laminas-coding-standard": "^2.5.0",
37+
"laminas/laminas-coding-standard": "^2.5",
3838
"mikey179/vfsstream": "^v1.6.11",
39-
"phpunit/phpunit": "^10.4.2",
40-
"vimeo/psalm": "^5.16.0"
39+
"phpunit/phpunit": "^10.5",
40+
"vimeo/psalm": "^5.23"
4141
},
4242
"autoload": {
4343
"psr-4": {

config/mail.global.php.dist

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
return [
44

55
/**
6-
* Dotkernel mail module configuration
6+
* DotKernel mail module configuration
77
* Note that many of these options can be set programmatically too, when sending mail messages
88
* actually that is what you'll usually do, these config provide just default and options that remain the same for all mails
99
*/
@@ -28,14 +28,10 @@ return [
2828
**/
2929

3030
'transport' => \Laminas\Mail\Transport\Sendmail::class,
31-
32-
// Uncomment the below line if you want to save a copy of all sent emails to a certain IMAP folder
33-
// Valid only if the Transport is SMTP
34-
// 'save_sent_message_folder' => ['INBOX.Sent'],
3531

3632
// Uncomment the below line if you want to save a copy of all sent emails to a certain IMAP folder
3733
// Valid only if the Transport is SMTP
38-
// 'save_sent_message_folder' => ['INBOX.Sent'],
34+
//'save_sent_message_folder' => ['INBOX.Sent'],
3935

4036
//message configuration
4137
'message_options' => [

docs/book/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../README.md

0 commit comments

Comments
 (0)