laravel-postmark icon indicating copy to clipboard operation
laravel-postmark copied to clipboard

Batch Email Sending

Open shimsag opened this issue 3 years ago • 7 comments

Postmark has an option for Batch Email sending.

It would be really good if you can add this feature to v3 so we can use Laravel 8 Mailer for our Newsletters.

shimsag avatar Mar 29 '21 10:03 shimsag

That's an interesting concept. Not sure how it would work in Laravel yet, but I can definitely look into it. Just for reference, this is the part of the documentation you're referring to, correct?

https://postmarkapp.com/developer/user-guide/send-email-with-api/batch-emails

craigpaul avatar Mar 29 '21 13:03 craigpaul

That's an interesting concept. Not sure how it would work in Laravel yet, but I can definitely look into it. Just for reference, this is the part of the documentation you're referring to, correct?

https://postmarkapp.com/developer/user-guide/send-email-with-api/batch-emails

Yes exactly.

shimsag avatar Mar 29 '21 16:03 shimsag

Hi,

I faced the same issue. I was able to send a mass email campaign from our web app by creating a simple command that uses the https://api.postmarkapp.com/email/batch endpoint.

Just in case someone is in a hurry and needs to achieve the same, here is a code example of how I made it:

https://gist.github.com/milardovich/947367309c05b0ddd16ea5c61a2a2207

I know it is not an ideal solution, but I hope it can be helpful for someone.

Thanks

milardovich avatar May 07 '21 19:05 milardovich

Hi,

I faced the same issue. I was able to send a mass email campaign from our web app by creating a simple command that uses the https://api.postmarkapp.com/email/batch endpoint.

Just in case someone is in a hurry and needs to achieve the same, here is a code example of how I made it:

https://gist.github.com/milardovich/947367309c05b0ddd16ea5c61a2a2207

I know it is not an ideal solution, but I hope it can be helpful for someone.

Thanks

Thank you! Does this use the Laravel Mailer? Where do you place this file?

shimsag avatar May 07 '21 20:05 shimsag

I have created a command, it should be placed under app/Console/Commands. Then you can execute with artisan: php artisan message-stream:send. Thanks

milardovich avatar May 07 '21 23:05 milardovich

FWIW I could really use this as well.

My thoughts on how it could work is by providing a facade to define either a mailable or postmark template, one or more email address, optionally define a message stream (default would be broadcast).

Something like this:

PostmarkBulk::mailable(new TosUpdatedMailable)->to(Users::all())->stream('legal-updates')->send();

I would try my hand at making this but honestly I don't know enough about how facades work to feel comfortable trying to build one or even knowing where to start for that matter.

James4645 avatar Aug 19 '22 05:08 James4645

+1

jadamec avatar May 04 '23 20:05 jadamec