Skip to content

Commit bb33a13

Browse files
committed
[Mime] deprecate attach/embed methods in favor of Email::addPart()
1 parent 30e0867 commit bb33a13

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Tests/Functional/Bundle/TestBundle/Controller/EmailController.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\Mailer\MailerInterface;
1616
use Symfony\Component\Mime\Address;
1717
use Symfony\Component\Mime\Email;
18+
use Symfony\Component\Mime\Part\DataPart;
1819

1920
class EmailController
2021
{
@@ -25,15 +26,15 @@ public function indexAction(MailerInterface $mailer)
2526
->addCc('cc@symfony.com')
2627
->text('Bar!')
2728
->html('<p>Foo</p>')
28-
->attach(file_get_contents(__FILE__), 'foobar.php')
29+
->addPart(new DataPart(file_get_contents(__FILE__), 'foobar.php'))
2930
);
3031

3132
$mailer->send((new Email())->to('fabien@symfony.com', 'thomas@symfony.com')->from('fabien@symfony.com')->subject('Foo')
3233
->addReplyTo(new Address('me@symfony.com', 'Fabien Potencier'))
3334
->addCc('cc@symfony.com')
3435
->text('Bar!')
3536
->html('<p>Foo</p>')
36-
->attach(file_get_contents(__FILE__), 'foobar.php')
37+
->addPart(new DataPart(file_get_contents(__FILE__), 'foobar.php'))
3738
);
3839

3940
return new Response();

0 commit comments

Comments
 (0)