Skip to content

Commit cee2e96

Browse files
committed
Embedding images support custom cid
1 parent 395539c commit cee2e96

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
@@ -616,11 +616,27 @@ images inside the HTML contents::
616616
->html('... <div background="cid:footer-signature"> ... </div> ...')
617617
;
618618

619+
You can also use :method:`DataPart::setContentId() <Symfony\\Component\\Mime\\Part\\DataPart::setContentId>` method to
620+
define value and use it as ``cid`` reference::
621+
622+
$part = new DataPart(new File('/path/to/images/signature.gif'));
623+
$part->setContentId('footer-signature');
624+
625+
$email = (new Email())
626+
// ...
627+
->addPart($part->asInline())
628+
->html('... <img src="cid:footer-signature"> ...')
629+
;
630+
619631
.. versionadded:: 6.1
620632

621633
The support of embedded images as HTML backgrounds was introduced in Symfony
622634
6.1.
623635

636+
.. versionadded:: 6.3
637+
638+
The support of custom ``cid`` for embedded images was introduced in Symfony 6.3.
639+
624640
.. _mailer-configure-email-globally:
625641

626642
Configuring Emails Globally

0 commit comments

Comments
 (0)