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 @@ -629,8 +629,8 @@ file or stream::
629629Use the ``asInline() `` method to embed the content instead of attaching it.
630630
631631The 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.
647648You can also use the :method: `DataPart::setContentId() <Symfony\\ Component\\ Mime\\ Part\\ DataPart::setContentId> `
648649method 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 :
You can’t perform that action at this time.
0 commit comments