File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -665,8 +665,8 @@ file or stream::
665665Use the ``asInline() `` method to embed the content instead of attaching it.
666666
667667The 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.
683684You can also use the :method: `DataPart::setContentId() <Symfony\\ Component\\ Mime\\ Part\\ DataPart::setContentId> `
684685method 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 :
You can’t perform that action at this time.
0 commit comments