d

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore.

15 St Margarets, NY 10033
(+381) 11 123 4567
ouroffice@aware.com

 

KMF

Create and Send Digest Emails in Laravel

The Laravel Digest package is a simple way to convert your emails into configurable digests. You can create and send digest emails using various configurable frequency types. For example, using this package, you could send a digest email to the site administrator for every 100 user registrations, a daily digest of all errors logged, or a monthly newsletter for all the posts created.

To use this package, you’ll define an observer (i.e., when a new user gets created) that will add a record to the digest:

1use HmonesLaravelDigestFacadesDigest;

2 

3public function created(User $user)

4{

5 $batchId = 'userCreated';

6 $mailable = UserCreatedMailable::class;

7 $data = ['name' => $user->name];

8 // Frequency can take values such as:

9 // daily, weekly, monthly, custom, or an

10 // integer threshold (10, 20, 30, etc.)

11 $frequency = 'custom';

12 

13 Digest::add($batchId, $mailable, $data, $frequency);

14}

The Laravel Digest package will take care of everything else from this point on, sending emails once the frequency is met.

To get started with this package, check out the source code on GitHub, including installation instructions and usage details.

Credit: Source link

Previous Next
Close
Test Caption
Test Description goes like this