addBcc example

$transport = new SendinblueApiTransport('ACCESS_KEY', $client);
        $transport->setPort(8984);

        $mail = new Email();
        $mail->subject('Hello!')
            ->to(new Address('saif.gmati@symfony.com', 'Saif Eddin'))
            ->from(new Address('fabpot@symfony.com', 'Fabien'))
            ->text('Hello here!')
            ->html('Hello there!')
            ->addCc('foo@bar.fr')
            ->addBcc('foo@bar.fr')
            ->addReplyTo('foo@bar.fr')
            ->addPart(new DataPart('body'))
        ;

        $message = $transport->send($mail);

        $this->assertSame('foobar', $message->getMessageId());
    }
}
$helene = new Address('helene@symfony.com');
        $thomas = new Address('thomas@symfony.com', 'Thomas');
        $caramel = new Address('caramel@symfony.com');

        $this->assertSame($e$e->bcc('fabien@symfony.com', $helene$thomas));
        $v = $e->getBcc();
        $this->assertCount(3, $v);
        $this->assertEquals(new Address('fabien@symfony.com')$v[0]);
        $this->assertSame($helene$v[1]);
        $this->assertSame($thomas$v[2]);

        $this->assertSame($e$e->addBcc('lucas@symfony.com', $caramel));
        $v = $e->getBcc();
        $this->assertCount(5, $v);
        $this->assertEquals(new Address('fabien@symfony.com')$v[0]);
        $this->assertSame($helene$v[1]);
        $this->assertSame($thomas$v[2]);
        $this->assertEquals(new Address('lucas@symfony.com')$v[3]);
        $this->assertSame($caramel$v[4]);

        $e = new Email();
        $e->addBcc('lucas@symfony.com', $caramel);
        $this->assertCount(2, $e->getBcc());

        
'subject' => $this,
                    'context' => $context,
                    'variables' => $variables,
                ]
            );
            $mail = Shopware()->TemplateMail()->createMail('sORDER', $context, null, $overrideConfig);
        }

        $mail->addTo($this->sUserData['additional']['user']['email'] ?? '');

        if (!$this->config->get('sNO_ORDER_MAIL')) {
            $mail->addBcc($this->config->get('sMAIL'));
        }

        $mail = $this->eventManager->filter('Shopware_Modules_Order_SendMail_Filter', $mail[
            'subject' => $this,
            'context' => $context,
            'variables' => $variables,
        ]);

        if (!($mail instanceof Zend_Mail)) {
            return;
        }

        
'response_headers' => ['x-message-id' => 'test_message_id'],
            ]);
        });

        $transport = new MailerSendApiTransport('ACCESS_KEY', $client);

        $mail = new Email();
        $mail->subject('Test subject')
            ->to(new Address('test_to@example.com', 'Test to name'))
            ->from(new Address('test_from@example.com', 'Test from name'))
            ->addCc('test_cc@example.com')
            ->addBcc('test_bcc@example.com')
            ->addReplyTo('test_reply_to@example.com')
            ->text('Lorem ipsum.')
            ->html('<html><body><p>Lorem ipsum.</p></body></html>');

        $message = $transport->send($mail);

        $this->assertSame('test_message_id', $message->getMessageId());
    }

    public function testSendEmailWithAttachment()
    {
        

                    }

                    switch ( $address_header ) {
                        case 'to':
                            $phpmailer->addAddress( $address$recipient_name );
                            break;
                        case 'cc':
                            $phpmailer->addCc( $address$recipient_name );
                            break;
                        case 'bcc':
                            $phpmailer->addBcc( $address$recipient_name );
                            break;
                        case 'reply_to':
                            $phpmailer->addReplyTo( $address$recipient_name );
                            break;
                    }
                } catch ( PHPMailer\PHPMailer\Exception $e ) {
                    continue;
                }
            }
        }

        
public function send(Email $email, ?Envelope $envelope = null): void
    {
        $failedRecipients = [];

        $disabled = $this->configService->get('core.mailerSettings.disableDelivery');
        if ($disabled) {
            return;
        }

        $deliveryAddress = $this->configService->getString('core.mailerSettings.deliveryAddress');
        if ($deliveryAddress !== '') {
            $email->addBcc($deliveryAddress);
        }

        try {
            $this->mailer->send($email$envelope);
        } catch (\Throwable $e) {
            throw new MailTransportFailedException($failedRecipients$e);
        }
    }
}
$transport = new BrevoApiTransport('ACCESS_KEY', $client);
        $transport->setPort(8984);

        $mail = new Email();
        $mail->subject('Hello!')
            ->to(new Address('saif.gmati@symfony.com', 'Saif Eddin'))
            ->from(new Address('fabpot@symfony.com', 'Fabien'))
            ->text('Hello here!')
            ->html('Hello there!')
            ->addCc('foo@bar.fr')
            ->addBcc('foo@bar.fr')
            ->addReplyTo('foo@bar.fr')
            ->addPart(new DataPart('body'));

        $message = $transport->send($mail);

        $this->assertSame('foobar', $message->getMessageId());
    }
}

    public function getCc(): array
    {
        return $this->message->getCc();
    }

    /** * @return $this */
    public function addBcc(string $address, string $name = '')static
    {
        $this->message->addBcc(new Address($address$name));

        return $this;
    }

    /** * @return Address[] */
    public function getBcc(): array
    {
        return $this->message->getBcc();
    }

    
foreach ($additionalData as $key => $value) {
            switch ($key) {
                case 'recipientsCc':
                    $mailAddresses = \is_array($value) ? $value : [$value => $value];
                    $this->assertValidAddresses(array_keys($mailAddresses));
                    $mail->addCc(...$this->formatMailAddresses($mailAddresses));

                    break;
                case 'recipientsBcc':
                    $mailAddresses = \is_array($value) ? $value : [$value => $value];
                    $this->assertValidAddresses(array_keys($mailAddresses));
                    $mail->addBcc(...$this->formatMailAddresses($mailAddresses));

                    break;
                case 'replyTo':
                    $mailAddresses = \is_array($value) ? $value : [$value => $value];
                    $this->assertValidAddresses(array_keys($mailAddresses));
                    $mail->addReplyTo(...$this->formatMailAddresses($mailAddresses));

                    break;
                case 'returnPath':
                    $mailAddresses = \is_array($value) ? $value : [$value => $value];
                    $this->assertValidAddresses(array_keys($mailAddresses));
                    
self::assertSame($this->iterableToString($signedMessage->toIterable())$this->iterableToString($restoredMessage->toIterable()));
        self::assertSame($signedMessage->toString()$restoredMessage->toString());

        $this->assertMessageSignatureIsValid($restoredMessage$message);
    }

    public function testSignedMessageWithBcc()
    {
        $message = (new Email())
            ->date(new \DateTimeImmutable('2019-04-07 10:36:30', new \DateTimeZone('Europe/Paris')))
            ->to('fabien@symfony.com')
            ->addBcc('fabien@symfony.com', 's.stok@rollerscapes.net')
            ->subject('I am your sign of fear')
            ->from('noreply@example.com')
            ->text('El Barto was not here');

        $signer = new SMimeSigner($this->samplesDir.'sign.crt', $this->samplesDir.'sign.key');
        $signedMessage = $signer->sign($message);

        $this->assertMessageSignatureIsValid($signedMessage$message);
    }

    public function testSignedMessageWithAttachments()
    {


        if (\array_key_exists('passwordConfirmation', $context)) {
            unset($context['passwordConfirmation']);
        }

        $mail = Shopware()->TemplateMail()->createMail('sREGISTERCONFIRMATION', $context);
        $mail->addTo($email);

        $sendConfirmationEmail = $this->config->get('sSEND_CONFIRM_MAIL');
        if (!empty($sendConfirmationEmail)) {
            $mail->addBcc($this->config->get('sMAIL'));
        }

        $this->eventManager->notify(
            'Shopware_Modules_Admin_SaveRegisterSendConfirmation_BeforeSend',
            ['subject' => $this, 'mail' => $mail]
        );

        $mail->send();

        return null;
    }

    
Home | Imprint | This part of the site doesn't use cookies.