Skip to content

Commit d68adfb

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: [Mailer] Minor tweaks [Mailer] Fixed and clarified custom Content-ID feature documentation
2 parents 454ffdb + 928e2ce commit d68adfb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

mailer.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,8 @@ file or stream::
629629
Use the ``asInline()`` method to embed the content instead of attaching it.
630630

631631
The second optional argument of both methods is the image name ("Content-ID" in
632-
the MIME standard). Its value is an arbitrary string used later to reference the
633-
images inside the HTML contents::
632+
the MIME standard). Its value is an arbitrary string that must be unique in each
633+
email message and is used later to reference the images inside the HTML contents::
634634

635635
$email = (new Email())
636636
// ...
@@ -644,16 +644,18 @@ images inside the HTML contents::
644644
->html('... <div background="cid:footer-signature"> ... </div> ...')
645645
;
646646

647+
The actual Content-ID value present in the e-mail source will be randomly generated by Symfony.
647648
You can also use the :method:`DataPart::setContentId() <Symfony\\Component\\Mime\\Part\\DataPart::setContentId>`
648649
method to define a custom Content-ID for the image and use it as its ``cid`` reference::
649650

650651
$part = new DataPart(new File('/path/to/images/signature.gif'));
651-
$part->setContentId('footer-signature');
652+
// according to the spec, the Content-ID value must include at least one '@' character
653+
$part->setContentId('footer-signature@my-app');
652654

653655
$email = (new Email())
654656
// ...
655657
->addPart($part->asInline())
656-
->html('... <img src="cid:footer-signature"> ...')
658+
->html('... <img src="cid:footer-signature@my-app"> ...')
657659
;
658660

659661
.. _mailer-configure-email-globally:

0 commit comments

Comments
 (0)