Skip to content

Commit ee7bc42

Browse files
committed
Merge branch '6.3' into 6.4
* 6.3: Embedding images support custom cid
2 parents 718ba0b + 69ab801 commit ee7bc42

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

mailer.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,11 +626,27 @@ images inside the HTML contents::
626626
->html('... <div background="cid:footer-signature"> ... </div> ...')
627627
;
628628

629+
You can also use the :method:`DataPart::setContentId() <Symfony\\Component\\Mime\\Part\\DataPart::setContentId>`
630+
method to define a custom Content-ID for the image and use it as its ``cid`` reference::
631+
632+
$part = new DataPart(new File('/path/to/images/signature.gif'));
633+
$part->setContentId('footer-signature');
634+
635+
$email = (new Email())
636+
// ...
637+
->addPart($part->asInline())
638+
->html('... <img src="cid:footer-signature"> ...')
639+
;
640+
629641
.. versionadded:: 6.1
630642

631643
The support of embedded images as HTML backgrounds was introduced in Symfony
632644
6.1.
633645

646+
.. versionadded:: 6.3
647+
648+
The support of custom ``cid`` for embedded images was introduced in Symfony 6.3.
649+
634650
.. _mailer-configure-email-globally:
635651

636652
Configuring Emails Globally

0 commit comments

Comments
 (0)