7.x is a bigger change which cleans up parts of the code base and modernizes the package. That means there are a few high-impact changes.
The way addresses are stored in the database has changed. Therefore, emails created in 6.x and below are incompatible.
When you upgrade, the existing database table will be renamed to "emails_old" and a new table will be created.
The table migration now needs to be published first. Please run this command:
php artisan vendor:publish --tag=database-emails-migrationsThen, run the migration:
php artisan migrateEnvironment variable names, as well as the config file name, have been shortened.
Please publish the new configuration file:
php artisan vendor:publish --tag=database-emails-configYou can remove the old configuration file.
Rename the following environments:
LARAVEL_DATABASE_EMAILS_TESTING_ENABLED→DB_EMAILS_TESTING_ENABLEDLARAVEL_DATABASE_EMAILS_SEND_IMMEDIATELY→DB_EMAILS_SEND_IMMEDIATELY
The following environments are new:
DB_EMAILS_ATTEMPTSDB_EMAILS_TESTING_EMAILDB_EMAILS_LIMITDB_EMAILS_IMMEDIATELY
The following environments have been removed:
LARAVEL_DATABASE_EMAILS_MANUAL_MIGRATIONSbecause migrations are always published.
The way emails are composed has changed and now borrows a lot from Laravel's mailable.
use Illuminate\Mail\Mailables\Content;
use Stackkit\LaravelDatabaseEmails\Attachment;
use Stackkit\LaravelDatabaseEmails\Email;
use Illuminate\Mail\Mailables\Envelope;
Email::compose()
->content(fn (Content $content) => $content
->view('tests::dummy')
->with(['name' => 'John Doe'])
)
->envelope(fn (Envelope $envelope) => $envelope
->subject('Hello')
->from('johndoe@example.com', 'John Doe')
->to('janedoe@example.com', 'Jane Doe')
)
->attachments([
Attachment::fromStorageDisk('s3', '/invoices/john-doe/march-2024.pdf'),
])
->send();
])E-mail encryption has been removed from the package.