69 lines
3.1 KiB
YAML
69 lines
3.1 KiB
YAML
name: PostmarkSmtpTransport
|
|
class_comment: '# * @author Kevin Verschaeve'
|
|
dependencies:
|
|
- name: EventDispatcherInterface
|
|
type: class
|
|
source: Psr\EventDispatcher\EventDispatcherInterface
|
|
- name: LoggerInterface
|
|
type: class
|
|
source: Psr\Log\LoggerInterface
|
|
- name: Envelope
|
|
type: class
|
|
source: Symfony\Component\Mailer\Envelope
|
|
- name: TransportException
|
|
type: class
|
|
source: Symfony\Component\Mailer\Exception\TransportException
|
|
- name: MetadataHeader
|
|
type: class
|
|
source: Symfony\Component\Mailer\Header\MetadataHeader
|
|
- name: TagHeader
|
|
type: class
|
|
source: Symfony\Component\Mailer\Header\TagHeader
|
|
- name: SentMessage
|
|
type: class
|
|
source: Symfony\Component\Mailer\SentMessage
|
|
- name: EsmtpTransport
|
|
type: class
|
|
source: Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport
|
|
- name: Message
|
|
type: class
|
|
source: Symfony\Component\Mime\Message
|
|
- name: RawMessage
|
|
type: class
|
|
source: Symfony\Component\Mime\RawMessage
|
|
properties: []
|
|
methods:
|
|
- name: setMessageStream
|
|
visibility: public
|
|
parameters:
|
|
- name: messageStream
|
|
comment: "# * @author Kevin Verschaeve\n# */\n# class PostmarkSmtpTransport extends\
|
|
\ EsmtpTransport\n# {\n# private ?string $messageStream = null;\n# \n# public\
|
|
\ function __construct(#[\\SensitiveParameter] string $id, ?EventDispatcherInterface\
|
|
\ $dispatcher = null, ?LoggerInterface $logger = null)\n# {\n# parent::__construct('smtp.postmarkapp.com',\
|
|
\ 587, false, $dispatcher, $logger);\n# \n# $this->setUsername($id);\n# $this->setPassword($id);\n\
|
|
# }\n# \n# public function send(RawMessage $message, ?Envelope $envelope = null):\
|
|
\ ?SentMessage\n# {\n# if ($message instanceof Message) {\n# $this->addPostmarkHeaders($message);\n\
|
|
# }\n# \n# return parent::send($message, $envelope);\n# }\n# \n# private function\
|
|
\ addPostmarkHeaders(Message $message): void\n# {\n# $message->getHeaders()->addTextHeader('X-PM-KeepID',\
|
|
\ 'true');\n# \n# $headers = $message->getHeaders();\n# \n# foreach ($headers->all()\
|
|
\ as $name => $header) {\n# if ($header instanceof TagHeader) {\n# if ($headers->has('X-PM-Tag'))\
|
|
\ {\n# throw new TransportException('Postmark only allows a single tag per email.');\n\
|
|
# }\n# \n# $headers->addTextHeader('X-PM-Tag', $header->getValue());\n# $headers->remove($name);\n\
|
|
# }\n# \n# if ($header instanceof MetadataHeader) {\n# $headers->addTextHeader('X-PM-Metadata-'.$header->getKey(),\
|
|
\ $header->getValue());\n# $headers->remove($name);\n# }\n# }\n# \n# if (null\
|
|
\ !== $this->messageStream && !$message->getHeaders()->has('X-PM-Message-Stream'))\
|
|
\ {\n# $headers->addTextHeader('X-PM-Message-Stream', $this->messageStream);\n\
|
|
# }\n# }\n# \n# /**\n# * @return $this"
|
|
traits:
|
|
- Psr\EventDispatcher\EventDispatcherInterface
|
|
- Psr\Log\LoggerInterface
|
|
- Symfony\Component\Mailer\Envelope
|
|
- Symfony\Component\Mailer\Exception\TransportException
|
|
- Symfony\Component\Mailer\Header\MetadataHeader
|
|
- Symfony\Component\Mailer\Header\TagHeader
|
|
- Symfony\Component\Mailer\SentMessage
|
|
- Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport
|
|
- Symfony\Component\Mime\Message
|
|
- Symfony\Component\Mime\RawMessage
|
|
interfaces: []
|