File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -665,8 +665,8 @@ file or stream::
665
665
Use the ``asInline() `` method to embed the content instead of attaching it.
666
666
667
667
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::
670
670
671
671
$email = (new Email())
672
672
// ...
@@ -680,16 +680,18 @@ images inside the HTML contents::
680
680
->html('... <div background="cid:footer-signature"> ... </div> ...')
681
681
;
682
682
683
+ The actual Content-ID value present in the e-mail source will be randomly generated by Symfony.
683
684
You can also use the :method: `DataPart::setContentId() <Symfony\\ Component\\ Mime\\ Part\\ DataPart::setContentId> `
684
685
method to define a custom Content-ID for the image and use it as its ``cid `` reference::
685
686
686
687
$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');
688
690
689
691
$email = (new Email())
690
692
// ...
691
693
->addPart($part->asInline())
692
- ->html('... <img src="cid:footer-signature"> ...')
694
+ ->html('... <img src="cid:footer-signature@my-app "> ...')
693
695
;
694
696
695
697
.. _mailer-configure-email-globally :
You can’t perform that action at this time.
0 commit comments