I want to send bulk mail (newsletters) with the Postmark Batch API. Postmark Batch API requires me to combine up to 500 mails per request.
Therefor I have created an custom NewslettersTransport.php which is handeling the API call and setting up the batch request. So far so good.
The content of the mails should be personalized. I am looking for a way to do this inside this Transport method, but I can't access my ViewVars set in NewsletterMailer.php
I'm searching for a different logic or a way to access the ViewVars / customize the message body.
// NewsletterMailer.php
return $this
->setEmailFormat('html')
->setTo($subscribers->all()->toArray())
->setFrom([$newsletter->sender => $company->companyname])
->setSubject($newsletter->name)
->setProfile('newsletter')
->setViewVars([
'company' => $company
])
->viewBuilder()
->setTemplate('newsletter_mail')
->setLayout('default');