How to embed a image using the ColdBox MailService plugin

147 Views Asked by At

I am using the ColdBox MailService plugin to send emails. I am not sure how to include/embed an image in my email.

I tried the <cfmailparm> tag but this will not work because it is not enclosed in a <cfmail> tag.

<img src="cid:headerImage" width="350" height="263" alt="" /><br />
 <cfmailparam file="/#application.rootDirectory#/includes/img/generic_header_lg.gif"
              contentid="headerImage"
              disposition="inline"/>

Is there another option I can try with the MailService plugin?

2

There are 2 best solutions below

1
On

The mail service has methods to add Params. Have you looked at the API

0
On

Extrapolating from the docs, try addMailParam(disposition='inline')

Example

local.Email.addMailParam(disposition="inline"
    ,file="/#application.rootDirectory#/includes/img/generic_header_lg.gif"
    ,contentid="headerImage");