Skip to content

Commit 6020d57

Browse files
committed
Merge branch '7.0' into 7.1
* 7.0: [Mailer] Minor tweaks [Mailer] Fixed and clarified custom Content-ID feature documentation
2 parents 38a5188 + d68adfb commit 6020d57

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Diff for: mailer.rst

+6-4
Original file line numberDiff line numberDiff line change
@@ -665,8 +665,8 @@ file or stream::
665665
Use the ``asInline()`` method to embed the content instead of attaching it.
666666

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

671671
$email = (new Email())
672672
// ...
@@ -680,16 +680,18 @@ images inside the HTML contents::
680680
->html('... <div background="cid:footer-signature"> ... </div> ...')
681681
;
682682

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

686687
$part = new DataPart(new File('/path/to/images/signature.gif'));
687-
$part->setContentId('footer-signature');
688+
// according to the spec, the Content-ID value must include at least one '@' character
689+
$part->setContentId('footer-signature@my-app');
688690

689691
$email = (new Email())
690692
// ...
691693
->addPart($part->asInline())
692-
->html('... <img src="cid:footer-signature"> ...')
694+
->html('... <img src="cid:footer-signature@my-app"> ...')
693695
;
694696

695697
.. _mailer-configure-email-globally:

0 commit comments

Comments
 (0)