[Mailer][DX][RFC] Rename mailer bridge transport classes

This commit is contained in:
Konstantin Myakshin 2019-07-19 01:02:22 +03:00 committed by Fabien Potencier
parent a86cdb5535
commit eda4f01e0e
40 changed files with 185 additions and 136 deletions

View File

@ -77,12 +77,12 @@ use Symfony\Component\Lock\PersistingStoreInterface;
use Symfony\Component\Lock\Store\FlockStore;
use Symfony\Component\Lock\Store\StoreFactory;
use Symfony\Component\Lock\StoreInterface;
use Symfony\Component\Mailer\Bridge\Amazon\Factory\SesTransportFactory;
use Symfony\Component\Mailer\Bridge\Google\Factory\GmailTransportFactory;
use Symfony\Component\Mailer\Bridge\Mailchimp\Factory\MandrillTransportFactory;
use Symfony\Component\Mailer\Bridge\Mailgun\Factory\MailgunTransportFactory;
use Symfony\Component\Mailer\Bridge\Postmark\Factory\PostmarkTransportFactory;
use Symfony\Component\Mailer\Bridge\Sendgrid\Factory\SendgridTransportFactory;
use Symfony\Component\Mailer\Bridge\Amazon\Transport\SesTransportFactory;
use Symfony\Component\Mailer\Bridge\Google\Transport\GmailTransportFactory;
use Symfony\Component\Mailer\Bridge\Mailchimp\Transport\MandrillTransportFactory;
use Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunTransportFactory;
use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory;
use Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridTransportFactory;
use Symfony\Component\Mailer\Mailer;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\MessageBus;

View File

@ -11,27 +11,27 @@
<argument type="service" id="logger" on-invalid="ignore" />
</service>
<service id="mailer.transport_factory.amazon" class="Symfony\Component\Mailer\Bridge\Amazon\Factory\SesTransportFactory" parent="mailer.transport_factory.abstract">
<service id="mailer.transport_factory.amazon" class="Symfony\Component\Mailer\Bridge\Amazon\Transport\SesTransportFactory" parent="mailer.transport_factory.abstract">
<tag name="mailer.transport_factory" />
</service>
<service id="mailer.transport_factory.gmail" class="Symfony\Component\Mailer\Bridge\Google\Factory\GmailTransportFactory" parent="mailer.transport_factory.abstract">
<service id="mailer.transport_factory.gmail" class="Symfony\Component\Mailer\Bridge\Google\Transport\GmailTransportFactory" parent="mailer.transport_factory.abstract">
<tag name="mailer.transport_factory" />
</service>
<service id="mailer.transport_factory.mailchimp" class="Symfony\Component\Mailer\Bridge\Mailchimp\Factory\MandrillTransportFactory" parent="mailer.transport_factory.abstract">
<service id="mailer.transport_factory.mailchimp" class="Symfony\Component\Mailer\Bridge\Mailchimp\Transport\MandrillTransportFactory" parent="mailer.transport_factory.abstract">
<tag name="mailer.transport_factory" />
</service>
<service id="mailer.transport_factory.mailgun" class="Symfony\Component\Mailer\Bridge\Mailgun\Factory\MailgunTransportFactory" parent="mailer.transport_factory.abstract">
<service id="mailer.transport_factory.mailgun" class="Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunTransportFactory" parent="mailer.transport_factory.abstract">
<tag name="mailer.transport_factory" />
</service>
<service id="mailer.transport_factory.postmark" class="Symfony\Component\Mailer\Bridge\Postmark\Factory\PostmarkTransportFactory" parent="mailer.transport_factory.abstract">
<service id="mailer.transport_factory.postmark" class="Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory" parent="mailer.transport_factory.abstract">
<tag name="mailer.transport_factory" />
</service>
<service id="mailer.transport_factory.sendgrid" class="Symfony\Component\Mailer\Bridge\Sendgrid\Factory\SendgridTransportFactory" parent="mailer.transport_factory.abstract">
<service id="mailer.transport_factory.sendgrid" class="Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridTransportFactory" parent="mailer.transport_factory.abstract">
<tag name="mailer.transport_factory" />
</service>

View File

@ -1,7 +1,15 @@
CHANGELOG
=========
4.4.0
-----
* [BC BREAK] Renamed and moved `Symfony\Component\Mailer\Bridge\Amazon\Http\Api\SesTransport`
to `Symfony\Component\Mailer\Bridge\Amazon\Transpor\SesApiTransport`, `Symfony\Component\Mailer\Bridge\Amazon\Http\SesTransport`
to `Symfony\Component\Mailer\Bridge\Amazon\Transport\SesHttpTransport`, `Symfony\Component\Mailer\Bridge\Amazon\Smtp\SesTransport`
to `Symfony\Component\Mailer\Bridge\Amazon\Transport\SesSmtpTransport`.
4.3.0
-----
* added the bridge
* Added the bridge

View File

@ -9,10 +9,12 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Amazon\Tests\Factory;
namespace Symfony\Component\Mailer\Bridge\Amazon\Tests\Transport;
use Symfony\Component\Mailer\Bridge\Amazon;
use Symfony\Component\Mailer\Bridge\Amazon\Factory\SesTransportFactory;
use Symfony\Component\Mailer\Bridge\Amazon\Transport\SesApiTransport;
use Symfony\Component\Mailer\Bridge\Amazon\Transport\SesHttpTransport;
use Symfony\Component\Mailer\Bridge\Amazon\Transport\SesSmtpTransport;
use Symfony\Component\Mailer\Bridge\Amazon\Transport\SesTransportFactory;
use Symfony\Component\Mailer\Tests\TransportFactoryTestCase;
use Symfony\Component\Mailer\Transport\Dsn;
use Symfony\Component\Mailer\Transport\TransportFactoryInterface;
@ -55,32 +57,32 @@ class SesTransportFactoryTest extends TransportFactoryTestCase
yield [
new Dsn('api', 'ses', self::USER, self::PASSWORD),
new Amazon\Http\Api\SesTransport(self::USER, self::PASSWORD, null, $client, $dispatcher, $logger),
new SesApiTransport(self::USER, self::PASSWORD, null, $client, $dispatcher, $logger),
];
yield [
new Dsn('api', 'ses', self::USER, self::PASSWORD, null, ['region' => 'eu-west-1']),
new Amazon\Http\Api\SesTransport(self::USER, self::PASSWORD, 'eu-west-1', $client, $dispatcher, $logger),
new SesApiTransport(self::USER, self::PASSWORD, 'eu-west-1', $client, $dispatcher, $logger),
];
yield [
new Dsn('http', 'ses', self::USER, self::PASSWORD),
new Amazon\Http\SesTransport(self::USER, self::PASSWORD, null, $client, $dispatcher, $logger),
new SesHttpTransport(self::USER, self::PASSWORD, null, $client, $dispatcher, $logger),
];
yield [
new Dsn('http', 'ses', self::USER, self::PASSWORD, null, ['region' => 'eu-west-1']),
new Amazon\Http\SesTransport(self::USER, self::PASSWORD, 'eu-west-1', $client, $dispatcher, $logger),
new SesHttpTransport(self::USER, self::PASSWORD, 'eu-west-1', $client, $dispatcher, $logger),
];
yield [
new Dsn('smtp', 'ses', self::USER, self::PASSWORD),
new Amazon\Smtp\SesTransport(self::USER, self::PASSWORD, null, $dispatcher, $logger),
new SesSmtpTransport(self::USER, self::PASSWORD, null, $dispatcher, $logger),
];
yield [
new Dsn('smtp', 'ses', self::USER, self::PASSWORD, null, ['region' => 'eu-west-1']),
new Amazon\Smtp\SesTransport(self::USER, self::PASSWORD, 'eu-west-1', $dispatcher, $logger),
new SesSmtpTransport(self::USER, self::PASSWORD, 'eu-west-1', $dispatcher, $logger),
];
}

View File

@ -9,12 +9,12 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Amazon\Http\Api;
namespace Symfony\Component\Mailer\Bridge\Amazon\Transport;
use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\Exception\HttpTransportException;
use Symfony\Component\Mailer\SmtpEnvelope;
use Symfony\Component\Mailer\Transport\Http\Api\AbstractApiTransport;
use Symfony\Component\Mailer\Transport\AbstractApiTransport;
use Symfony\Component\Mime\Email;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
@ -23,7 +23,7 @@ use Symfony\Contracts\HttpClient\ResponseInterface;
/**
* @author Kevin Verschaeve
*/
class SesTransport extends AbstractApiTransport
class SesApiTransport extends AbstractApiTransport
{
private const ENDPOINT = 'https://email.%region%.amazonaws.com';

View File

@ -9,12 +9,12 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Amazon\Http;
namespace Symfony\Component\Mailer\Bridge\Amazon\Transport;
use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\Exception\HttpTransportException;
use Symfony\Component\Mailer\SentMessage;
use Symfony\Component\Mailer\Transport\Http\AbstractHttpTransport;
use Symfony\Component\Mailer\Transport\AbstractHttpTransport;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Symfony\Contracts\HttpClient\ResponseInterface;
@ -22,7 +22,7 @@ use Symfony\Contracts\HttpClient\ResponseInterface;
/**
* @author Kevin Verschaeve
*/
class SesTransport extends AbstractHttpTransport
class SesHttpTransport extends AbstractHttpTransport
{
private const ENDPOINT = 'https://email.%region%.amazonaws.com';

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Amazon\Smtp;
namespace Symfony\Component\Mailer\Bridge\Amazon\Transport;
use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
@ -18,7 +18,7 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
/**
* @author Kevin Verschaeve
*/
class SesTransport extends EsmtpTransport
class SesSmtpTransport extends EsmtpTransport
{
/**
* @param string $region Amazon SES region (currently one of us-east-1, us-west-2, or eu-west-1)

View File

@ -9,9 +9,8 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Amazon\Factory;
namespace Symfony\Component\Mailer\Bridge\Amazon\Transport;
use Symfony\Component\Mailer\Bridge\Amazon;
use Symfony\Component\Mailer\Exception\UnsupportedSchemeException;
use Symfony\Component\Mailer\Transport\AbstractTransportFactory;
use Symfony\Component\Mailer\Transport\Dsn;
@ -30,15 +29,15 @@ final class SesTransportFactory extends AbstractTransportFactory
$region = $dsn->getOption('region');
if ('api' === $scheme) {
return new Amazon\Http\Api\SesTransport($user, $password, $region, $this->client, $this->dispatcher, $this->logger);
return new SesApiTransport($user, $password, $region, $this->client, $this->dispatcher, $this->logger);
}
if ('http' === $scheme) {
return new Amazon\Http\SesTransport($user, $password, $region, $this->client, $this->dispatcher, $this->logger);
return new SesHttpTransport($user, $password, $region, $this->client, $this->dispatcher, $this->logger);
}
if ('smtp' === $scheme) {
return new Amazon\Smtp\SesTransport($user, $password, $region, $this->dispatcher, $this->logger);
return new SesSmtpTransport($user, $password, $region, $this->dispatcher, $this->logger);
}
throw new UnsupportedSchemeException($dsn, ['api', 'http', 'smtp']);

View File

@ -1,7 +1,13 @@
CHANGELOG
=========
4.4.0
-----
* [BC BREAK] Renamed and moved `Symfony\Component\Mailer\Bridge\Google\Smtp\GmailTransport`
to `Symfony\Component\Mailer\Bridge\Google\Transport\GmailSmtpTransport`.
4.3.0
-----
* added the bridge
* Added the bridge

View File

@ -1,9 +1,9 @@
<?php
namespace Symfony\Component\Mailer\Bridge\Google\Tests\Factory;
namespace Symfony\Component\Mailer\Bridge\Google\Tests\Transport;
use Symfony\Component\Mailer\Bridge\Google\Factory\GmailTransportFactory;
use Symfony\Component\Mailer\Bridge\Google\Smtp\GmailTransport;
use Symfony\Component\Mailer\Bridge\Google\Transport\GmailSmtpTransport;
use Symfony\Component\Mailer\Bridge\Google\Transport\GmailTransportFactory;
use Symfony\Component\Mailer\Tests\TransportFactoryTestCase;
use Symfony\Component\Mailer\Transport\Dsn;
use Symfony\Component\Mailer\Transport\TransportFactoryInterface;
@ -32,7 +32,7 @@ class GmailTransportFactoryTest extends TransportFactoryTestCase
{
yield [
new Dsn('smtp', 'gmail', self::USER, self::PASSWORD),
new GmailTransport(self::USER, self::PASSWORD, $this->getDispatcher(), $this->getLogger()),
new GmailSmtpTransport(self::USER, self::PASSWORD, $this->getDispatcher(), $this->getLogger()),
];
}

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Google\Smtp;
namespace Symfony\Component\Mailer\Bridge\Google\Transport;
use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
@ -18,7 +18,7 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
/**
* @author Kevin Verschaeve
*/
class GmailTransport extends EsmtpTransport
class GmailSmtpTransport extends EsmtpTransport
{
public function __construct(string $username, string $password, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
{

View File

@ -9,9 +9,8 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Google\Factory;
namespace Symfony\Component\Mailer\Bridge\Google\Transport;
use Symfony\Component\Mailer\Bridge\Google\Smtp\GmailTransport;
use Symfony\Component\Mailer\Exception\UnsupportedSchemeException;
use Symfony\Component\Mailer\Transport\AbstractTransportFactory;
use Symfony\Component\Mailer\Transport\Dsn;
@ -25,7 +24,7 @@ final class GmailTransportFactory extends AbstractTransportFactory
public function create(Dsn $dsn): TransportInterface
{
if ('smtp' === $dsn->getScheme()) {
return new GmailTransport($this->getUser($dsn), $this->getPassword($dsn), $this->dispatcher, $this->logger);
return new GmailSmtpTransport($this->getUser($dsn), $this->getPassword($dsn), $this->dispatcher, $this->logger);
}
throw new UnsupportedSchemeException($dsn, ['smtp']);

View File

@ -1,7 +1,15 @@
CHANGELOG
=========
4.4.0
-----
* [BC BREAK] Renamed and moved `Symfony\Component\Mailer\Bridge\Mailchimp\Http\Api\MandrillTransport`
to `Symfony\Component\Mailer\Bridge\Mailchimp\Transport\MandrillApiTransport`, `Symfony\Component\Mailer\Bridge\Mailchimp\Http\MandrillTransport`
to `Symfony\Component\Mailer\Bridge\Mailchimp\Transport\MandrillHttpTransport`, `Symfony\Component\Mailer\Bridge\Mailchimp\Smtp\MandrillTransport`
to `Symfony\Component\Mailer\Bridge\Mailchimp\Transport\MandrillSmtpTransport`.
4.3.0
-----
* added the bridge
* Added the bridge

View File

@ -9,10 +9,12 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Mailchimp\Tests\Factory;
namespace Symfony\Component\Mailer\Bridge\Mailchimp\Tests\Transport;
use Symfony\Component\Mailer\Bridge\Mailchimp;
use Symfony\Component\Mailer\Bridge\Mailchimp\Factory\MandrillTransportFactory;
use Symfony\Component\Mailer\Bridge\Mailchimp\Transport\MandrillApiTransport;
use Symfony\Component\Mailer\Bridge\Mailchimp\Transport\MandrillHttpTransport;
use Symfony\Component\Mailer\Bridge\Mailchimp\Transport\MandrillSmtpTransport;
use Symfony\Component\Mailer\Bridge\Mailchimp\Transport\MandrillTransportFactory;
use Symfony\Component\Mailer\Tests\TransportFactoryTestCase;
use Symfony\Component\Mailer\Transport\Dsn;
use Symfony\Component\Mailer\Transport\TransportFactoryInterface;
@ -55,17 +57,17 @@ class MandrillTransportFactoryTest extends TransportFactoryTestCase
yield [
new Dsn('api', 'mandrill', self::USER),
new Mailchimp\Http\Api\MandrillTransport(self::USER, $client, $dispatcher, $logger),
new MandrillApiTransport(self::USER, $client, $dispatcher, $logger),
];
yield [
new Dsn('http', 'mandrill', self::USER),
new Mailchimp\Http\MandrillTransport(self::USER, $client, $dispatcher, $logger),
new MandrillHttpTransport(self::USER, $client, $dispatcher, $logger),
];
yield [
new Dsn('smtp', 'mandrill', self::USER, self::PASSWORD),
new Mailchimp\Smtp\MandrillTransport(self::USER, self::PASSWORD, $dispatcher, $logger),
new MandrillSmtpTransport(self::USER, self::PASSWORD, $dispatcher, $logger),
];
}

View File

@ -9,12 +9,12 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Mailchimp\Http\Api;
namespace Symfony\Component\Mailer\Bridge\Mailchimp\Transport;
use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\Exception\HttpTransportException;
use Symfony\Component\Mailer\SmtpEnvelope;
use Symfony\Component\Mailer\Transport\Http\Api\AbstractApiTransport;
use Symfony\Component\Mailer\Transport\AbstractApiTransport;
use Symfony\Component\Mime\Email;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
@ -23,7 +23,7 @@ use Symfony\Contracts\HttpClient\ResponseInterface;
/**
* @author Kevin Verschaeve
*/
class MandrillTransport extends AbstractApiTransport
class MandrillApiTransport extends AbstractApiTransport
{
private const ENDPOINT = 'https://mandrillapp.com/api/1.0/messages/send.json';

View File

@ -9,12 +9,12 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Mailchimp\Http;
namespace Symfony\Component\Mailer\Bridge\Mailchimp\Transport;
use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\Exception\HttpTransportException;
use Symfony\Component\Mailer\SentMessage;
use Symfony\Component\Mailer\Transport\Http\AbstractHttpTransport;
use Symfony\Component\Mailer\Transport\AbstractHttpTransport;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Symfony\Contracts\HttpClient\ResponseInterface;
@ -22,7 +22,7 @@ use Symfony\Contracts\HttpClient\ResponseInterface;
/**
* @author Kevin Verschaeve
*/
class MandrillTransport extends AbstractHttpTransport
class MandrillHttpTransport extends AbstractHttpTransport
{
private const ENDPOINT = 'https://mandrillapp.com/api/1.0/messages/send-raw.json';
private $key;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Mailchimp\Smtp;
namespace Symfony\Component\Mailer\Bridge\Mailchimp\Transport;
use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
@ -18,7 +18,7 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
/**
* @author Kevin Verschaeve
*/
class MandrillTransport extends EsmtpTransport
class MandrillSmtpTransport extends EsmtpTransport
{
public function __construct(string $username, string $password, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
{

View File

@ -9,9 +9,8 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Mailchimp\Factory;
namespace Symfony\Component\Mailer\Bridge\Mailchimp\Transport;
use Symfony\Component\Mailer\Bridge\Mailchimp;
use Symfony\Component\Mailer\Exception\UnsupportedSchemeException;
use Symfony\Component\Mailer\Transport\AbstractTransportFactory;
use Symfony\Component\Mailer\Transport\Dsn;
@ -28,17 +27,17 @@ final class MandrillTransportFactory extends AbstractTransportFactory
$user = $this->getUser($dsn);
if ('api' === $scheme) {
return new Mailchimp\Http\Api\MandrillTransport($user, $this->client, $this->dispatcher, $this->logger);
return new MandrillApiTransport($user, $this->client, $this->dispatcher, $this->logger);
}
if ('http' === $scheme) {
return new Mailchimp\Http\MandrillTransport($user, $this->client, $this->dispatcher, $this->logger);
return new MandrillHttpTransport($user, $this->client, $this->dispatcher, $this->logger);
}
if ('smtp' === $scheme) {
$password = $this->getPassword($dsn);
return new Mailchimp\Smtp\MandrillTransport($user, $password, $this->dispatcher, $this->logger);
return new MandrillSmtpTransport($user, $password, $this->dispatcher, $this->logger);
}
throw new UnsupportedSchemeException($dsn, ['api', 'http', 'smtp']);

View File

@ -1,7 +1,15 @@
CHANGELOG
=========
4.4.0
-----
* [BC BREAK] Renamed and moved `Symfony\Component\Mailer\Bridge\Mailgun\Http\Api\MailgunTransport`
to `Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunApiTransport`, `Symfony\Component\Mailer\Bridge\Mailgun\Http\MailgunTransport`
to `Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunHttpTransport`, `Symfony\Component\Mailer\Bridge\Mailgun\Smtp\MailgunTransport`
to `Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunSmtpTransport`.
4.3.0
-----
* added the bridge
* Added the bridge

View File

@ -9,10 +9,12 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Mailgun\Tests\Factory;
namespace Symfony\Component\Mailer\Bridge\Mailgun\Tests\Transport;
use Symfony\Component\Mailer\Bridge\Mailgun;
use Symfony\Component\Mailer\Bridge\Mailgun\Factory\MailgunTransportFactory;
use Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunApiTransport;
use Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunHttpTransport;
use Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunSmtpTransport;
use Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunTransportFactory;
use Symfony\Component\Mailer\Tests\TransportFactoryTestCase;
use Symfony\Component\Mailer\Transport\Dsn;
use Symfony\Component\Mailer\Transport\TransportFactoryInterface;
@ -55,22 +57,22 @@ class MailgunTransportFactoryTest extends TransportFactoryTestCase
yield [
new Dsn('api', 'mailgun', self::USER, self::PASSWORD),
new Mailgun\Http\Api\MailgunTransport(self::USER, self::PASSWORD, null, $client, $dispatcher, $logger),
new MailgunApiTransport(self::USER, self::PASSWORD, null, $client, $dispatcher, $logger),
];
yield [
new Dsn('api', 'mailgun', self::USER, self::PASSWORD, null, ['region' => 'eu']),
new Mailgun\Http\Api\MailgunTransport(self::USER, self::PASSWORD, 'eu', $client, $dispatcher, $logger),
new MailgunApiTransport(self::USER, self::PASSWORD, 'eu', $client, $dispatcher, $logger),
];
yield [
new Dsn('http', 'mailgun', self::USER, self::PASSWORD),
new Mailgun\Http\MailgunTransport(self::USER, self::PASSWORD, null, $client, $dispatcher, $logger),
new MailgunHttpTransport(self::USER, self::PASSWORD, null, $client, $dispatcher, $logger),
];
yield [
new Dsn('smtp', 'mailgun', self::USER, self::PASSWORD),
new Mailgun\Smtp\MailgunTransport(self::USER, self::PASSWORD, null, $dispatcher, $logger),
new MailgunSmtpTransport(self::USER, self::PASSWORD, null, $dispatcher, $logger),
];
}

View File

@ -9,12 +9,12 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Mailgun\Http\Api;
namespace Symfony\Component\Mailer\Bridge\Mailgun\Transport;
use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\Exception\HttpTransportException;
use Symfony\Component\Mailer\SmtpEnvelope;
use Symfony\Component\Mailer\Transport\Http\Api\AbstractApiTransport;
use Symfony\Component\Mailer\Transport\AbstractApiTransport;
use Symfony\Component\Mime\Email;
use Symfony\Component\Mime\Part\Multipart\FormDataPart;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
@ -24,7 +24,7 @@ use Symfony\Contracts\HttpClient\ResponseInterface;
/**
* @author Kevin Verschaeve
*/
class MailgunTransport extends AbstractApiTransport
class MailgunApiTransport extends AbstractApiTransport
{
private const ENDPOINT = 'https://api.%region_dot%mailgun.net/v3/%domain%/messages';

View File

@ -9,12 +9,12 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Mailgun\Http;
namespace Symfony\Component\Mailer\Bridge\Mailgun\Transport;
use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\Exception\HttpTransportException;
use Symfony\Component\Mailer\SentMessage;
use Symfony\Component\Mailer\Transport\Http\AbstractHttpTransport;
use Symfony\Component\Mailer\Transport\AbstractHttpTransport;
use Symfony\Component\Mime\Part\DataPart;
use Symfony\Component\Mime\Part\Multipart\FormDataPart;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
@ -24,7 +24,7 @@ use Symfony\Contracts\HttpClient\ResponseInterface;
/**
* @author Kevin Verschaeve
*/
class MailgunTransport extends AbstractHttpTransport
class MailgunHttpTransport extends AbstractHttpTransport
{
private const ENDPOINT = 'https://api.%region_dot%mailgun.net/v3/%domain%/messages.mime';
private $key;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Mailgun\Smtp;
namespace Symfony\Component\Mailer\Bridge\Mailgun\Transport;
use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
@ -18,7 +18,7 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
/**
* @author Kevin Verschaeve
*/
class MailgunTransport extends EsmtpTransport
class MailgunSmtpTransport extends EsmtpTransport
{
public function __construct(string $username, string $password, string $region = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
{

View File

@ -9,9 +9,8 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Mailgun\Factory;
namespace Symfony\Component\Mailer\Bridge\Mailgun\Transport;
use Symfony\Component\Mailer\Bridge\Mailgun;
use Symfony\Component\Mailer\Exception\UnsupportedSchemeException;
use Symfony\Component\Mailer\Transport\AbstractTransportFactory;
use Symfony\Component\Mailer\Transport\Dsn;
@ -30,15 +29,15 @@ final class MailgunTransportFactory extends AbstractTransportFactory
$region = $dsn->getOption('region');
if ('api' === $scheme) {
return new Mailgun\Http\Api\MailgunTransport($user, $password, $region, $this->client, $this->dispatcher, $this->logger);
return new MailgunApiTransport($user, $password, $region, $this->client, $this->dispatcher, $this->logger);
}
if ('http' === $scheme) {
return new Mailgun\Http\MailgunTransport($user, $password, $region, $this->client, $this->dispatcher, $this->logger);
return new MailgunHttpTransport($user, $password, $region, $this->client, $this->dispatcher, $this->logger);
}
if ('smtp' === $scheme) {
return new Mailgun\Smtp\MailgunTransport($user, $password, $region, $this->dispatcher, $this->logger);
return new MailgunSmtpTransport($user, $password, $region, $this->dispatcher, $this->logger);
}
throw new UnsupportedSchemeException($dsn, ['api', 'http', 'smtp']);

View File

@ -1,7 +1,14 @@
CHANGELOG
=========
4.4.0
-----
* [BC BREAK] Renamed and moved `Symfony\Component\Mailer\Bridge\Postmark\Http\Api\PostmarkTransport`
to `Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkApiTransport`, `Symfony\Component\Mailer\Bridge\Postmark\Smtp\PostmarkTransport`
to `Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkSmtpTransport`.
4.3.0
-----
* added the bridge
* Added the bridge

View File

@ -9,10 +9,11 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Postmark\Tests\Factory;
namespace Symfony\Component\Mailer\Bridge\Postmark\Tests\Transport;
use Symfony\Component\Mailer\Bridge\Postmark;
use Symfony\Component\Mailer\Bridge\Postmark\Factory\PostmarkTransportFactory;
use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkApiTransport;
use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkSmtpTransport;
use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory;
use Symfony\Component\Mailer\Tests\TransportFactoryTestCase;
use Symfony\Component\Mailer\Transport\Dsn;
use Symfony\Component\Mailer\Transport\TransportFactoryInterface;
@ -49,12 +50,12 @@ class PostmarkTransportFactoryTest extends TransportFactoryTestCase
yield [
new Dsn('api', 'postmark', self::USER),
new Postmark\Http\Api\PostmarkTransport(self::USER, $this->getClient(), $dispatcher, $logger),
new PostmarkApiTransport(self::USER, $this->getClient(), $dispatcher, $logger),
];
yield [
new Dsn('smtp', 'postmark', self::USER),
new Postmark\Smtp\PostmarkTransport(self::USER, $dispatcher, $logger),
new PostmarkSmtpTransport(self::USER, $dispatcher, $logger),
];
}

View File

@ -9,12 +9,12 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Postmark\Http\Api;
namespace Symfony\Component\Mailer\Bridge\Postmark\Transport;
use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\Exception\HttpTransportException;
use Symfony\Component\Mailer\SmtpEnvelope;
use Symfony\Component\Mailer\Transport\Http\Api\AbstractApiTransport;
use Symfony\Component\Mailer\Transport\AbstractApiTransport;
use Symfony\Component\Mime\Email;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
@ -23,7 +23,7 @@ use Symfony\Contracts\HttpClient\ResponseInterface;
/**
* @author Kevin Verschaeve
*/
class PostmarkTransport extends AbstractApiTransport
class PostmarkApiTransport extends AbstractApiTransport
{
private const ENDPOINT = 'http://api.postmarkapp.com/email';

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Postmark\Smtp;
namespace Symfony\Component\Mailer\Bridge\Postmark\Transport;
use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
@ -18,7 +18,7 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
/**
* @author Kevin Verschaeve
*/
class PostmarkTransport extends EsmtpTransport
class PostmarkSmtpTransport extends EsmtpTransport
{
public function __construct(string $id, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
{

View File

@ -9,9 +9,8 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Postmark\Factory;
namespace Symfony\Component\Mailer\Bridge\Postmark\Transport;
use Symfony\Component\Mailer\Bridge\Postmark;
use Symfony\Component\Mailer\Exception\UnsupportedSchemeException;
use Symfony\Component\Mailer\Transport\AbstractTransportFactory;
use Symfony\Component\Mailer\Transport\Dsn;
@ -28,11 +27,11 @@ final class PostmarkTransportFactory extends AbstractTransportFactory
$user = $this->getUser($dsn);
if ('api' === $scheme) {
return new Postmark\Http\Api\PostmarkTransport($user, $this->client, $this->dispatcher, $this->logger);
return new PostmarkApiTransport($user, $this->client, $this->dispatcher, $this->logger);
}
if ('smtp' === $scheme) {
return new Postmark\Smtp\PostmarkTransport($user, $this->dispatcher, $this->logger);
return new PostmarkSmtpTransport($user, $this->dispatcher, $this->logger);
}
throw new UnsupportedSchemeException($dsn, ['api', 'smtp']);

View File

@ -1,7 +1,14 @@
CHANGELOG
=========
4.4.0
-----
* [BC BREAK] Renamed and moved `Symfony\Component\Mailer\Bridge\Sendgrid\Http\Api\SendgridTransport`
to `Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridApiTransport`, `Symfony\Component\Mailer\Bridge\Sendgrid\Smtp\SendgridTransport`
to `Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridSmtpTransport`.
4.3.0
-----
* added the bridge
* Added the bridge

View File

@ -9,10 +9,11 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Sendgrid\Tests\Factory;
namespace Symfony\Component\Mailer\Bridge\Sendgrid\Tests\Transport;
use Symfony\Component\Mailer\Bridge\Sendgrid;
use Symfony\Component\Mailer\Bridge\Sendgrid\Factory\SendgridTransportFactory;
use Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridApiTransport;
use Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridSmtpTransport;
use Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridTransportFactory;
use Symfony\Component\Mailer\Tests\TransportFactoryTestCase;
use Symfony\Component\Mailer\Transport\Dsn;
use Symfony\Component\Mailer\Transport\TransportFactoryInterface;
@ -49,12 +50,12 @@ class SendgridTransportFactoryTest extends TransportFactoryTestCase
yield [
new Dsn('api', 'sendgrid', self::USER),
new Sendgrid\Http\Api\SendgridTransport(self::USER, $this->getClient(), $dispatcher, $logger),
new SendgridApiTransport(self::USER, $this->getClient(), $dispatcher, $logger),
];
yield [
new Dsn('smtp', 'sendgrid', self::USER),
new Sendgrid\Smtp\SendgridTransport(self::USER, $dispatcher, $logger),
new SendgridSmtpTransport(self::USER, $dispatcher, $logger),
];
}

View File

@ -9,12 +9,12 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Sendgrid\Http\Api;
namespace Symfony\Component\Mailer\Bridge\Sendgrid\Transport;
use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\Exception\HttpTransportException;
use Symfony\Component\Mailer\SmtpEnvelope;
use Symfony\Component\Mailer\Transport\Http\Api\AbstractApiTransport;
use Symfony\Component\Mailer\Transport\AbstractApiTransport;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Email;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
@ -24,7 +24,7 @@ use Symfony\Contracts\HttpClient\ResponseInterface;
/**
* @author Kevin Verschaeve
*/
class SendgridTransport extends AbstractApiTransport
class SendgridApiTransport extends AbstractApiTransport
{
private const ENDPOINT = 'https://api.sendgrid.com/v3/mail/send';

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Sendgrid\Smtp;
namespace Symfony\Component\Mailer\Bridge\Sendgrid\Transport;
use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
@ -18,7 +18,7 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
/**
* @author Kevin Verschaeve
*/
class SendgridTransport extends EsmtpTransport
class SendgridSmtpTransport extends EsmtpTransport
{
public function __construct(string $key, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
{

View File

@ -9,9 +9,8 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Sendgrid\Factory;
namespace Symfony\Component\Mailer\Bridge\Sendgrid\Transport;
use Symfony\Component\Mailer\Bridge\Sendgrid;
use Symfony\Component\Mailer\Exception\UnsupportedSchemeException;
use Symfony\Component\Mailer\Transport\AbstractTransportFactory;
use Symfony\Component\Mailer\Transport\Dsn;
@ -27,11 +26,11 @@ final class SendgridTransportFactory extends AbstractTransportFactory
$key = $this->getUser($dsn);
if ('api' === $dsn->getScheme()) {
return new Sendgrid\Http\Api\SendgridTransport($key, $this->client, $this->dispatcher, $this->logger);
return new SendgridApiTransport($key, $this->client, $this->dispatcher, $this->logger);
}
if ('smtp' === $dsn->getScheme()) {
return new Sendgrid\Smtp\SendgridTransport($key, $this->dispatcher, $this->logger);
return new SendgridSmtpTransport($key, $this->dispatcher, $this->logger);
}
throw new UnsupportedSchemeException($dsn, ['api', 'smtp']);

View File

@ -4,6 +4,7 @@ CHANGELOG
4.4.0
-----
* [BC BREAK] Classes `AbstractApiTransport` and `AbstractHttpTransport` moved under `Transport` sub-namespace.
* [BC BREAK] Transports depend on `Symfony\Contracts\EventDispatcher\EventDispatcherInterface`
instead of `Symfony\Component\EventDispatcher\EventDispatcherInterface`.
* Added possibility to register custom transport for dsn by implementing

View File

@ -21,27 +21,27 @@ class UnsupportedHostException extends LogicException
{
private const HOST_TO_PACKAGE_MAP = [
'gmail' => [
'class' => Bridge\Google\Factory\GmailTransportFactory::class,
'class' => Bridge\Google\Transport\GmailTransportFactory::class,
'package' => 'symfony/google-mailer',
],
'mailgun' => [
'class' => Bridge\Mailgun\Factory\MailgunTransportFactory::class,
'class' => Bridge\Mailgun\Transport\MailgunTransportFactory::class,
'package' => 'symfony/mailgun-mailer',
],
'postmark' => [
'class' => Bridge\Postmark\Factory\PostmarkTransportFactory::class,
'class' => Bridge\Postmark\Transport\PostmarkTransportFactory::class,
'package' => 'symfony/postmark-mailer',
],
'sendgrid' => [
'class' => Bridge\Sendgrid\Factory\SendgridTransportFactory::class,
'class' => Bridge\Sendgrid\Transport\SendgridTransportFactory::class,
'package' => 'symfony/sendgrid-mailer',
],
'ses' => [
'class' => Bridge\Amazon\Factory\SesTransportFactory::class,
'class' => Bridge\Amazon\Transport\SesTransportFactory::class,
'package' => 'symfony/amazon-mailer',
],
'mandrill' => [
'class' => Bridge\Mailchimp\Factory\MandrillTransportFactory::class,
'class' => Bridge\Mailchimp\Transport\MandrillTransportFactory::class,
'package' => 'symfony/mailchimp-mailer',
],
];

View File

@ -16,6 +16,8 @@ use Symfony\Component\Mailer\SentMessage;
use Symfony\Component\Mailer\SmtpEnvelope;
use Symfony\Component\Mailer\Transport;
use Symfony\Component\Mailer\Transport\Dsn;
use Symfony\Component\Mailer\Transport\FailoverTransport;
use Symfony\Component\Mailer\Transport\RoundRobinTransport;
use Symfony\Component\Mailer\Transport\TransportInterface;
use Symfony\Component\Mime\RawMessage;
@ -43,12 +45,12 @@ class TransportTest extends TestCase
yield 'failover transport' => [
'dummy://a || dummy://b',
new Transport\FailoverTransport([$transportA, $transportB]),
new FailoverTransport([$transportA, $transportB]),
];
yield 'round robin transport' => [
'dummy://a && dummy://b',
new Transport\RoundRobinTransport([$transportA, $transportB]),
new RoundRobinTransport([$transportA, $transportB]),
];
}
}

View File

@ -12,15 +12,17 @@
namespace Symfony\Component\Mailer;
use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\Bridge\Amazon\Factory\SesTransportFactory;
use Symfony\Component\Mailer\Bridge\Google\Factory\GmailTransportFactory;
use Symfony\Component\Mailer\Bridge\Mailchimp\Factory\MandrillTransportFactory;
use Symfony\Component\Mailer\Bridge\Mailgun\Factory\MailgunTransportFactory;
use Symfony\Component\Mailer\Bridge\Postmark\Factory\PostmarkTransportFactory;
use Symfony\Component\Mailer\Bridge\Sendgrid\Factory\SendgridTransportFactory;
use Symfony\Component\Mailer\Bridge\Amazon\Transport\SesTransportFactory;
use Symfony\Component\Mailer\Bridge\Google\Transport\GmailTransportFactory;
use Symfony\Component\Mailer\Bridge\Mailchimp\Transport\MandrillTransportFactory;
use Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunTransportFactory;
use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory;
use Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridTransportFactory;
use Symfony\Component\Mailer\Exception\UnsupportedHostException;
use Symfony\Component\Mailer\Transport\Dsn;
use Symfony\Component\Mailer\Transport\FailoverTransport;
use Symfony\Component\Mailer\Transport\NullTransportFactory;
use Symfony\Component\Mailer\Transport\RoundRobinTransport;
use Symfony\Component\Mailer\Transport\SendmailTransportFactory;
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransportFactory;
use Symfony\Component\Mailer\Transport\TransportFactoryInterface;
@ -64,12 +66,12 @@ class Transport
{
$dsns = preg_split('/\s++\|\|\s++/', $dsn);
if (\count($dsns) > 1) {
return new Transport\FailoverTransport($this->createFromDsns($dsns));
return new FailoverTransport($this->createFromDsns($dsns));
}
$dsns = preg_split('/\s++&&\s++/', $dsn);
if (\count($dsns) > 1) {
return new Transport\RoundRobinTransport($this->createFromDsns($dsns));
return new RoundRobinTransport($this->createFromDsns($dsns));
}
return $this->fromDsnObject(Dsn::fromString($dsn));

View File

@ -9,12 +9,11 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Transport\Http\Api;
namespace Symfony\Component\Mailer\Transport;
use Symfony\Component\Mailer\Exception\RuntimeException;
use Symfony\Component\Mailer\SentMessage;
use Symfony\Component\Mailer\SmtpEnvelope;
use Symfony\Component\Mailer\Transport\Http\AbstractHttpTransport;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Email;
use Symfony\Component\Mime\MessageConverter;

View File

@ -9,13 +9,12 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Transport\Http;
namespace Symfony\Component\Mailer\Transport;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Component\Mailer\Exception\HttpTransportException;
use Symfony\Component\Mailer\SentMessage;
use Symfony\Component\Mailer\Transport\AbstractTransport;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Symfony\Contracts\HttpClient\ResponseInterface;