Вход Регистрация
Файл: vendor/symfony/mailer/Transport/AbstractApiTransport.php
Строк: 91
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace SymfonyComponentMailerTransport;

use 
SymfonyComponentMailerEnvelope;
use 
SymfonyComponentMailerExceptionRuntimeException;
use 
SymfonyComponentMailerSentMessage;
use 
SymfonyComponentMimeAddress;
use 
SymfonyComponentMimeEmail;
use 
SymfonyComponentMimeMessageConverter;
use 
SymfonyContractsHttpClientResponseInterface;

/**
 * @author Fabien Potencier <fabien@symfony.com>
 */
abstract class AbstractApiTransport extends AbstractHttpTransport
{
    abstract protected function 
doSendApi(SentMessage $sentMessageEmail $emailEnvelope $envelope): ResponseInterface;

    protected function 
doSendHttp(SentMessage $message): ResponseInterface
    
{
        try {
            
$email MessageConverter::toEmail($message->getOriginalMessage());
        } catch (
Exception $e) {
            throw new 
RuntimeException(sprintf('Unable to send message with the "%s" transport: '__CLASS__).$e->getMessage(), 0$e);
        }

        return 
$this->doSendApi($message$email$message->getEnvelope());
    }

    protected function 
getRecipients(Email $emailEnvelope $envelope): array
    {
        return 
array_filter($envelope->getRecipients(), function (Address $address) use ($email) {
            return 
false === in_array($addressarray_merge($email->getCc(), $email->getBcc()), true);
        });
    }
}
Онлайн: 0
Реклама