activecampaign / swiftmailer-postmark Goto Github PK
View Code? Open in Web Editor NEWThe Official Swiftmailer Transport for Postmark.
Home Page: https://postmarkapp.com
The Official Swiftmailer Transport for Postmark.
Home Page: https://postmarkapp.com
As the laravel-postmark-provider is no longer officially supported, perhaps remove this from composer.json as a suggestion.
I am using this package with Laravel 8 application, and would like to integrate Batch email sending. Are there plans to add Batch sending soon ?
composer require wildbit/swiftmailer-postmark
Using version ^3.2 for wildbit/swiftmailer-postmark
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Can only install one of: guzzlehttp/guzzle[6.5.x-dev, 7.0.1].
- Can only install one of: guzzlehttp/guzzle[7.0.1, 6.5.x-dev].
- Can only install one of: guzzlehttp/guzzle[6.5.x-dev, 7.0.1].
- wildbit/swiftmailer-postmark 3.2.0 requires guzzlehttp/guzzle ^6.0.0 -> satisfiable by guzzlehttp/guzzle[6.5.x-dev].
- Installation request for wildbit/swiftmailer-postmark ^3.2 -> satisfiable by wildbit/swiftmailer-postmark[3.2.0].
- Installation request for guzzlehttp/guzzle (locked at 7.0.1, required as ^7.0.1) -> satisfiable by guzzlehttp/guzzle[7.0.1].
Installation failed, reverting ./composer.json to its original content.
Would there be any way of you hooking up your sendEmailBatch()
endpoint with this adapter.
Be awesome if this could be supported out of the box, its used with the awesome CraftCMS:
https://github.com/craftcms/postmark
https://docs.craftcms.com/api/v3/craft-mail-mailer.html
https://www.yiiframework.com/doc/api/2.0/yii-mail-basemailer#sendMultiple()-detail
http_errors is set to false in the send method. How then can errors be caught e.g. network issues or postmark api issues?
The definition of Swift_Transport->send function requires to return int. You return result of http client call.
When sending symfony do this
$count += $transport->send($message, $failedRecipients);
With your implementation it will cause
Notice: Object of class GuzzleHttp\Psr7\Response could not be converted to int
The Swiftmailer transport for Postmark does not support broadcasting streams yet.
The method getMessagePayload
needs to check for the X-PM-Message-Stream
header defined in the docs to set the "streams"
json key:
https://github.com/wildbit/swiftmailer-postmark/blob/master/src/Postmark/Transport.php#L167
https://postmarkapp.com/support/article/1207-how-to-create-and-send-through-message-streams
Hello there!
I'm using Laravel and Postmark using this adapter. I'm trying to send a message and add metadata/tags to it. Reading through the code & docs, I figured my best bet would be to add X-PM headers as per the SMTP documentation. I tried doing that:
public function build()
{
$this->withSwiftMessage(function (\Swift_Message $message) {
$message->getHeaders()->addTextHeader('X-PM-Metadata-document-id', $this->document->id);
});
$client_name = $this->document->client->name;
return $this->markdown('emails.documents.review')
->attach($this->document->download_path, ['as' => $this->document->file_name])
->subject('Document for review - ' . $client_name);
}
The headers do get added to the message (I can see them when clicking the "raw source" tab in the UI) but Postmark doesn't seem to care for such headers when using the API.
Maybe it's possible to handle these special headers in the adapter? I see that there is some kind of precedent here.
Thank you!
Guilherme
During testing, we discovered that a text/plain
body is not sent whenever an additional part is added to the message later on.
Example (taken from Swiftmailer docs):
$message = Swift_Message::newInstance()
->setSubject('Your subject')
->setFrom(array('[email protected]'))
->setTo(array('[email protected]'))
->setBody('Here is the message itself', 'text/plain')
->addPart('<q>Here is the message itself</q>', 'text/html')
;
At the moment the transport just assumes that the main body of any multipart message is text/html
. It seems this issue can not be resolved just yet, as the content type of the body is not exposed: swiftmailer/swiftmailer#736
As a workaround, we use setBody
for HTML and addPart
for text. The parts get reordered anyway.
I received this error when only setting a BCC message.
Uncaught TypeError: Argument 1 passed to Postmark\Transport::convertEmailsArray() must be of the type array, null given, called in Transport.php on line 138 and defined in Transport.php:82
Stack trace:
#0 Transport.php(138): Postmark\Transport->convertEmailsArray(NULL)
#1 Transport.php(118): Postmark\Transport->processRecipients(Array, Object(Swift_Message))
#2 Transport.php(70): Postmark\Transport->getMessagePayload(Object(Swift_Message))
#3 Transport->send(Ob
After inspecting it though it looks like it is set.
Swiftmailer 5.2
Could you please clarify the license of this pacakge please?
Is there a way to do this currently? Other packages such as https://github.com/craigpaul/laravel-postmark add this as a header like so when the message is sent:
$message->getHeaders()->addTextHeader(
'X-PM-Message-Id',
$this->getMessageId($response)
);
I'd like to use this package as it is the Laravel recommendation but require this functionality. Would you be interested in a Pull Request?
When you install the transport in a newer Symfony project, it installs swiftmailer 6.0+ where the Swift_Mime_Message class is removed thus the following error occurs;
PHP Warning: Uncaught ReflectionException: Class Swift_Mime_Message not found in vendor/wildbit/swiftmailer-postmark/src/Postmark/Transport.php:10
Will this package be updated for Swift Mailer 6? (Released in May.)
Looks like the only thing you’d need to add is a ping()
method.
refs: 9d3c7c8
You shouldn’t add this adapter to this repository, since it requires Illuminate\*
classes that aren’t defined anywhere. The proper way would be to create wildbit/laravel-postmark-provider
that require both laravel/laravel
and this package and put it there.
More on that topic: http://php-and-symfony.matthiasnoback.nl/2014/04/theres-no-such-thing-as-an-optional-dependency/
It was just released, but creating an issue to raise awareness :)
I'm using a newsletter application (Mailcoach) where you can define two different mail drivers:
Postmark also suggests sending through different streams.
This package lets you define the "Postmark Message Stream" by adding the stream id to the header. But when you use the postmark
driver in Laravel, you only have the option to define the token
seen here: https://github.com/laravel/framework/blob/bd67cc22af6fbc1f5745b0e3ce79e0a12b092048/src/Illuminate/Mail/MailManager.php#L325
So even if I create two postmark mail drivers, I could only use a different API token (= 2 different Postmark "servers"), but I cannot define the message stream.
If the above assumptions are correct, I could do a PR on Laravel to also get a headers
array from the services.php
config file. What do you think?
getServerToken() references '$this->token'
Should that not be $this->serverToken ?
Getting this error when running composer:
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.