returnPath example

public function getSubject(): ?string
    {
        return $this->message->getSubject();
    }

    /** * @return $this */
    public function setReturnPath(string $address)static
    {
        $this->message->returnPath($address);

        return $this;
    }

    public function getReturnPath(): string
    {
        return $this->message->getReturnPath();
    }

    /** * @return $this */
$transport = new SesApiAsyncAwsTransport(new SesClient(Configuration::create([])new NullProvider()$client));

        $mail = new Email();
        $mail->subject('Hello!')
            ->to(new Address('saif.gmati@symfony.com', 'Saif Eddin'))
            ->cc(new Address('jeremy@derusse.com', 'Jérémy'))
            ->from(new Address('fabpot@symfony.com', 'Fabién'))
            ->text('Hello There!')
            ->html('<b>Hello There!</b>')
            ->replyTo(new Address('replyto-1@example.com')new Address('replyto-2@example.com'))
            ->returnPath(new Address('bounces@example.com'));

        $mail->getHeaders()->addTextHeader('X-SES-CONFIGURATION-SET', 'aws-configuration-set-name');
        $mail->getHeaders()->addTextHeader('X-SES-SOURCE-ARN', 'aws-source-arn');
        $mail->getHeaders()->add(new MetadataHeader('tagName1', 'tag Value1'));
        $mail->getHeaders()->add(new MetadataHeader('tagName2', 'tag Value2'));

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

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

    
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));
                    $mail->returnPath(...$this->formatMailAddresses($mailAddresses));
            }
        }

        return $mail;
    }

    public function getDecorated(): AbstractMailFactory
    {
        throw new DecorationPatternException(self::class);
    }

    
public function testDate()
    {
        $e = new Email();
        $e->date($d = new \DateTimeImmutable());
        $this->assertEquals($d$e->getDate());
    }

    public function testReturnPath()
    {
        $e = new Email();
        $e->returnPath('fabien@symfony.com');
        $this->assertEquals(new Address('fabien@symfony.com')$e->getReturnPath());
    }

    public function testSender()
    {
        $e = new Email();
        $e->sender('fabien@symfony.com');
        $this->assertEquals(new Address('fabien@symfony.com')$e->getSender());

        $e->sender($fabien = new Address('fabien@symfony.com'));
        $this->assertSame($fabien$e->getSender());
    }
Home | Imprint | This part of the site doesn't use cookies.