You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All notable changes to this project will be documented in this file.
3
+
4
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
+
7
+
## 3.0.1 - 2018-03-18
8
+
### Changed
9
+
- Updated README.md
10
+
- Deprecated `email:retry`, please use `email:resend`
11
+
12
+
## 3.0.0 - 2017-12-22
13
+
### Added
14
+
- Support for a custom sender per e-mail.
15
+
16
+
### Upgrade from 2.x to 3.x
17
+
18
+
3.0.0 added support for a custom sender per e-mail. To update please run the following command:
19
+
20
+
```bash
21
+
php artisan migrate
22
+
```
23
+
24
+
## 2.0.0 - 2017-12-14
25
+
### Added
26
+
- Support for multiple recipients, cc and bcc addresses.
27
+
- Support for mailables (*)
28
+
- Support for attachments
29
+
- New method `later`
30
+
31
+
*= Only works for Laravel versions 5.5 and up because 5.5 finally introduced a method to read the mailable body.
32
+
33
+
### Fixed
34
+
- Bug causing failed e-mails not to be resent
35
+
36
+
### Upgrade from 1.x to 2.x
37
+
Because 2.0.0 introduced support for attachments, the database needs to be updated. Simply run the following two commands after updating your dependencies and running composer update:
38
+
39
+
```bash
40
+
php artisan migrate
41
+
```
42
+
43
+
## 1.1.3 - 2017-12-07
44
+
### Fixed
45
+
- Created a small backwards compatibility fix for Laravel versions 5.4 and below.
46
+
47
+
## 1.1.2 - 2017-11-18
48
+
### Fixed
49
+
- Incorrect auto discovery namespace for Laravel 5.5
50
+
51
+
52
+
## 1.1.1 - 2017-08-02
53
+
### Changed
54
+
- Only dispatch `before.send` event during unit tests
This is a package that stores and queues e-mails using a database table. Easily send e-mails using a cronjob and schedule e-mails that should be sent at a specific date and time.
Using the above configuration, the `email:send` process will exit after 5 minutes (`--timeout`) and won't overlap if the process still runs after 5 minutes (`withoutOverlapping`)
72
+
73
+
### Usage
55
74
56
-
###Create An Email
75
+
#### Send an email
57
76
58
77
```php
78
+
use Buildcode\LaravelDatabaseEmails\Email;
79
+
59
80
Email::compose()
60
-
->label('welcome-mail-1.0')
81
+
->label('welcome')
61
82
->recipient('john@doe.com')
62
83
->subject('This is a test')
63
84
->view('emails.welcome')
@@ -67,83 +88,118 @@ Email::compose()
67
88
->send();
68
89
```
69
90
70
-
### Specify Recipients
91
+
####Specify multiple recipients
71
92
72
93
```php
73
-
$one = 'john@doe.com';
74
-
$multiple = ['john@doe.com', 'jane@doe.com'];
94
+
use Buildcode\LaravelDatabaseEmails\Email;
75
95
76
-
Email::compose()->recipient($one);
77
-
Email::compose()->recipient($multiple);
96
+
Buildcode\LaravelDatabaseEmails\Email::compose()
97
+
->recipient([
98
+
'john@doe.com',
99
+
'jane@doe.com'
100
+
]);
101
+
```
78
102
79
-
Email::compose()->cc($one);
80
-
Email::compose()->cc($multiple);
103
+
#### CC and BCC
81
104
82
-
Email::compose()->bcc($one);
83
-
Email::compose()->bcc($multiple);
105
+
```php
106
+
use Buildcode\LaravelDatabaseEmails\Email;
107
+
108
+
Email::compose()
109
+
->cc('john@doe.com')
110
+
->cc(['john@doe.com', 'jane@doe.com'])
111
+
->bcc('john@doe.com')
112
+
->bcc(['john@doe.com', 'jane@doe.com']);
84
113
```
85
114
86
-
###Mailables
115
+
#### Using mailables
87
116
88
117
You may also pass a mailable to the e-mail composer.
89
118
90
119
```php
120
+
use Buildcode\LaravelDatabaseEmails\Email;
121
+
122
+
Email::compose()
123
+
->mailable(new OrderShipped())
124
+
->send();
125
+
```
126
+
127
+
#### Attachments
128
+
129
+
```php
130
+
use Buildcode\LaravelDatabaseEmails\Email;
131
+
91
132
Email::compose()
92
-
->mailable(new OrderShipped())
93
-
->send();
133
+
->attach('/path/to/file');
94
134
```
95
135
96
-
### Attachments
136
+
Or for in-memory attachments:
97
137
98
138
```php
139
+
use Buildcode\LaravelDatabaseEmails\Email;
140
+
99
141
Email::compose()
100
-
->attach('/path/to/file');
142
+
->attachData('<p>Your order has shipped!</p>', 'order.html');
101
143
```
102
144
103
-
Or for in-memory attachments...
145
+
#### Custom Sender
104
146
105
147
```php
148
+
use Buildcode\LaravelDatabaseEmails\Email;
149
+
106
150
Email::compose()
107
-
->attachData('<p>Your order has shipped!</p>', 'order.html');
151
+
->from('john@doe.com', 'John Doe');
108
152
```
109
153
110
-
###Schedule An Email
154
+
#### Scheduling
111
155
112
-
You may schedule an e-mail by calling `later` instead of `send` at the end of the chain. You must provide a Carbon instance or a strtotime valid date.
156
+
You may schedule an e-mail by calling `later` instead of `send`. You must provide a Carbon instance or a strtotime valid date.
113
157
114
158
```php
159
+
use Buildcode\LaravelDatabaseEmails\Email;
160
+
115
161
Email::compose()
116
-
->later('+2 hours');
162
+
->later('+2 hours');
117
163
```
118
164
119
-
###Manually Sending E-mails
165
+
#### Resend failed e-mails
120
166
121
-
If you're not running the cronjob and wish to send the queued e-mails, you can run the `email:send` command.
167
+
##### Resend all failed e-mails
122
168
123
169
```bash
124
-
$ php artisan email:send
170
+
php artisan email:resend
125
171
```
126
172
127
-
###Failed E-mails
173
+
##### Resend a specific failed e-mail
128
174
129
-
By default, we will attempt to send an e-mail 3 times if it fails. If it still fails the 3rd time, it will permanently be marked as failed. You can change the number of times an e-mail should be attempted to be sent using the `retry.attempts` configuration.
175
+
```bash
176
+
php artisan email:resend 1
177
+
```
130
178
131
-
###Retry sending failed e-mails
179
+
#### Encryption (Optional)
132
180
133
-
If you wish to retry sending failed e-mails, you may call the `email:retry` command. The command will grab any failed e-mail and push it onto the queue. You may also provide the id of a specific e-mail.
181
+
If you wish to encrypt your e-mails, please enable the `encrypt` option in the configuration file. This is disabled by default. Encryption and decryption will be handled by Laravel's built-in encryption mechanism. Please note that by encrypting the e-mail it takes more disk space.
134
182
135
-
```bash
136
-
$ php artisan email:retry
137
-
# or...
138
-
$ php artisan email:retry 1
139
-
```
183
+
```text
184
+
Without encryption
185
+
186
+
7 bytes (label)
187
+
16 bytes (recipient)
188
+
20 bytes (subject)
189
+
48 bytes (view name)
190
+
116 bytes (variables)
191
+
1874 bytes (e-mail content)
192
+
4 bytes (attempts, sending, failed, encrypted)
193
+
57 bytes (created_at, updated_at, deleted_at)
194
+
... x 10.000 rows = ± 21.55 MB
140
195
141
-
### Encryption
196
+
With encryption the table size is ± 50.58 MB.
197
+
```
142
198
143
-
If you wish to encrypt your e-mails, please enable the `encrypt` option in the configuration file. This is disabled by default. Encryption and decryption will be handled by Laravel's built-in encryption mechanism. Please note that encrypting the e-mail body takes a lot of disk space.
199
+
#### Test mode (Optional)
144
200
145
-
### Testing Address
201
+
When enabled, all newly created e-mails will be sent to the specified test e-mail address. This is turned off by default.
146
202
147
-
If you wish to send e-mails to a test address but don't necessarily want to use a service like mailtrap, please take a look at the `testing` configuration. This is turned off by default.
203
+
#### E-mails to send per minute
148
204
149
-
During the creation of an e-mail, the recipient will be replaced by the test e-mail. This is useful for local development or testing on a staging server.
205
+
To configure how many e-mails should be sent each command, please check the `limit` option. The default is `20` e-mails every command.
0 commit comments