Skip to content

Commit b4f121a

Browse files
committed
feature symfony#58698 [Mailer] Add AhaSend Bridge (farhadhf)
This PR was squashed before being merged into the 7.3 branch. Discussion ---------- [Mailer] Add AhaSend Bridge | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | | License | MIT | Doc PR | symfony/symfony-docs#20361 | Recipe PR | symfony/recipes#1350 This PR adds support for a new mail bridge for the [AhaSend](https://ahasend.com) email service. It includes support for SMTP and API transports (along with support for attachments for the API transport), and both delivery and engagement webhooks. Commits ------- 3dfad14 [Mailer] Add AhaSend Bridge
2 parents f86c095 + 3dfad14 commit b4f121a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1352
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2745,6 +2745,7 @@ private function registerMailerConfiguration(array $config, ContainerBuilder $co
27452745
}
27462746

27472747
$classToServices = [
2748+
MailerBridge\AhaSend\Transport\AhaSendTransportFactory::class => 'mailer.transport_factory.ahasend',
27482749
MailerBridge\Azure\Transport\AzureTransportFactory::class => 'mailer.transport_factory.azure',
27492750
MailerBridge\Brevo\Transport\BrevoTransportFactory::class => 'mailer.transport_factory.brevo',
27502751
MailerBridge\Google\Transport\GmailTransportFactory::class => 'mailer.transport_factory.gmail',
@@ -2775,6 +2776,7 @@ private function registerMailerConfiguration(array $config, ContainerBuilder $co
27752776

27762777
if ($webhookEnabled) {
27772778
$webhookRequestParsers = [
2779+
MailerBridge\AhaSend\Webhook\AhaSendRequestParser::class => 'mailer.webhook.request_parser.ahasend',
27782780
MailerBridge\Brevo\Webhook\BrevoRequestParser::class => 'mailer.webhook.request_parser.brevo',
27792781
MailerBridge\MailerSend\Webhook\MailerSendRequestParser::class => 'mailer.webhook.request_parser.mailersend',
27802782
MailerBridge\Mailchimp\Webhook\MailchimpRequestParser::class => 'mailer.webhook.request_parser.mailchimp',

src/Symfony/Bundle/FrameworkBundle/Resources/config/mailer_transports.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
1313

14+
use Symfony\Component\Mailer\Bridge\AhaSend\Transport\AhaSendTransportFactory;
1415
use Symfony\Component\Mailer\Bridge\Amazon\Transport\SesTransportFactory;
1516
use Symfony\Component\Mailer\Bridge\Azure\Transport\AzureTransportFactory;
1617
use Symfony\Component\Mailer\Bridge\Brevo\Transport\BrevoTransportFactory;
@@ -47,6 +48,7 @@
4748
->tag('monolog.logger', ['channel' => 'mailer']);
4849

4950
$factories = [
51+
'ahasend' => AhaSendTransportFactory::class,
5052
'amazon' => SesTransportFactory::class,
5153
'azure' => AzureTransportFactory::class,
5254
'brevo' => BrevoTransportFactory::class,

src/Symfony/Bundle/FrameworkBundle/Resources/config/mailer_webhook.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
1313

14+
use Symfony\Component\Mailer\Bridge\AhaSend\RemoteEvent\AhaSendPayloadConverter;
15+
use Symfony\Component\Mailer\Bridge\AhaSend\Webhook\AhaSendRequestParser;
1416
use Symfony\Component\Mailer\Bridge\Brevo\RemoteEvent\BrevoPayloadConverter;
1517
use Symfony\Component\Mailer\Bridge\Brevo\Webhook\BrevoRequestParser;
1618
use Symfony\Component\Mailer\Bridge\Mailchimp\RemoteEvent\MailchimpPayloadConverter;
@@ -86,6 +88,11 @@
8688
->args([service('mailer.payload_converter.sweego')])
8789
->alias(SweegoRequestParser::class, 'mailer.webhook.request_parser.sweego')
8890

91+
->set('mailer.payload_converter.ahasend', AhaSendPayloadConverter::class)
92+
->set('mailer.webhook.request_parser.ahasend', AhaSendRequestParser::class)
93+
->args([service('mailer.payload_converter.ahasend')])
94+
->alias(AhaSendRequestParser::class, 'mailer.webhook.request_parser.ahasend')
95+
8996
->set('mailer.payload_converter.mailchimp', MailchimpPayloadConverter::class)
9097
->set('mailer.webhook.request_parser.mailchimp', MailchimpRequestParser::class)
9198
->args([service('mailer.payload_converter.mailchimp')])
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/Tests export-ignore
2+
/phpunit.xml.dist export-ignore
3+
/.git* export-ignore

src/Symfony/Component/Mailer/Bridge/AhaSend/.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Symfony/Component/Mailer/Bridge/AhaSend/.github/workflows/close-pull-request.yml

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
vendor/
2+
composer.lock
3+
phpunit.xml
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CHANGELOG
2+
=========
3+
4+
7.3
5+
---
6+
* Add the bridge
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Mailer\Bridge\AhaSend\Event;
13+
14+
class AhaSendDeliveryEvent
15+
{
16+
public function __construct(
17+
private readonly string $message,
18+
) {
19+
}
20+
21+
public function getMessage(): string
22+
{
23+
return $this->message;
24+
}
25+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2024-present Fabien Potencier
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

0 commit comments

Comments
 (0)