Reputation: 52
I've pasted a image in CKEditor and stored into DB. After retrive the data and sent to a mail. The Text content is displaying into the email but not displaying the image. I'm not sure how to display the image in email without cfmailparam. I've stored those content in cfsavecontent and put the variable into the cfmail tag. Exmple code given following..
<cfsavecontent variable="MailBody">
<cfoutput>
Test comment with Image<br /> <br /> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAAA5CAYAAADUS9LZAAAgAElEQVR4nO2cZ3wUV5qvu429O7t7d2Y8YefO7O7d3Uswygnl0N2SWjnngGWwwUOyMZiMQUKARJDIOdlgvAM2BmyQkEAJRVAAJCFEEpiclEBSd3V/ee6H6i61JPDYHsC+gHsUyRAAAAAElFTkSuQmCC" /><br /> <br /> test signature<br /> thanks,<br /> tester
</cfoutput>
</cfsavecontent>
Note: The img src data is rough value.
<cfmail from="[email protected]" subject="TestEmail" to="[email protected]" server="SMTP">
#MailBody#
</cfmail>
Now the email sending without the image. Its working fine in CF2010 and not working in CF2016.
How can I display that image into the mail? Please guide me I'm a new guy for the CF technology.
Thanks in Advance!
Upvotes: 1
Views: 643
Reputation: 61
Instead of img
tag use cfimage
tag with isBase64="yes"
attribute. Like this,
<cfsavecontent variable="MailBody">
Test comment with Image<br /><cfimage action = "writeToBrowser" source ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUg..." isBase64= "yes">
<br /> <br /> <br /> test signature<br /> thanks,<br /> tester
</cfsavecontent>
<cfmail from="[email protected]" subject="TestEmail" to="[email protected]" server="SMTP">
<cfmailpart type="text/html">
#MailBody#
</cfmailpart>
</cfmail>
Upvotes: 2