How do you send Postmark emails with multiple DB records?

Ok, so context - I want to send a weekly email to users with a list of 10 of the most recent jobs posted that week. I use Postmark - any suggestions?

basically just take DB users as a list and put that in API Call

2 Likes

Be sure you are using the right type of email sending format in postmark.

Postmark is normally used for “transactional” emails, and it sounds like you’re talking about “marketing” emails.

Postmark won’t like that and could shut your account down.

Postmark has a specific api to send out marketing (bulk/mass) emails.

1 Like

It’s not a marketing email, it’s a setting that the user can turn on to have aggregated jobs sent directly to them at the frequency they specify.

If it’s 10 items every time make a standard HTML template you’ll create (can use my plugin for this or any HTML builder)

Where the item block div container is you’ll copy that code and remove it from the base template and replace it with {{code}}

Now take the individual block div code and use “do search for jobs:items until 10:formatted as text”

Now you will paste that block container code that you copied from earlier inside the formatted as text. Replace the name area with “this jobs name” and similar for all dynamics.

Now you will use find and replace to replace {{code}} with the list that was generated from :formatted as text.

This should result in a full HTML email formatted from your initial template with now a list of those 10 searched items.

Alternatively you can go the long route of using an html template of all 10 items pre made using placeholders like {{item1name}} {{item2name}} etc and just do a large find and replace call or a looped find and replace call and cut out the :formatted as text. (This route will be less ideal but still work)

1 Like

Yeah, I totally understand, but according to postmark i think what you described would be considered “marketing”.

“A marketing email would be anything a customer did not specifically trigger: for example, a weekly newsletter, a promotional offer, or an announcement about your site’s recent updates”

From: Transactional vs. marketing email explained | Postmark

Anyway, just something for you to consider.

1 Like

I agree with @jobs. Postmark would count this as a broadcast stream — which makes sense. If you’re getting a digest every week, I’d hope that there would be a way to opt-out of it. If not, you’d get a lot of spam reports and your domain reputation will go down.

Batched requests is the way to go and the way @chris.williamson1996 described it is the method you’re going to want to use.

I would note that batched requests are limited to 500 at a time, so keep that in mind as you create a scalable way to send out these weekly digest emails.

3 Likes

I will give this a try this weekend, thank you!

1 Like

the Postmark documentation is very nice, but if you have questions don t hesitate.

Where do you put this? This is how I currently have it set up:


Also, where would I put in the dynamic content within the format as text code? Each job post has its own user, title, ‘View this Job’ link.