Need Help for ColdFusion mail sending

pranjalsharda
pranjalsharda used Ask the Experts™
on
I need help for sending mail in coldfusion along with embeded images in mail

Can some one help

I am unable to get this info from anywhere

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Build the string with all html tag. so put the image in the <img src="test.gif">


let ur string like

<cfset str= "">
<cfset str = str & "<html><head><title>test</title></head>">

<cfset str = str & "<body><img src=""<path>"">

<cfoutput>
cfmail to="<to email id>" from="<from email id>"
               subject="<subject>" type="HTML">

  #str#

</cfmail>
</cfoutput>

let me know.

regards,
Dash

Author

Commented:
Thanks Dash,

But this will not send the mails with embedded image

I need to send mail with embedding

Pranjal

Commented:
Hi pranjalsharda,

Do you mean attached to the mail (an attachment) or just embedded in html like dash suggested?

Jet
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

Commented:
Hi pranjalsharda,

it is not possible to send image in the mail body. you can do it if u send the mail with attachment file. and file containing the image.  

Author

Commented:
Hi All,
I had tried a code I got from google search somebody had posted it Here is the code



<cfmail to="me@mydomain.com" from="me@mydomain.com" subject="test image">
<cfmailparam name="mime-version" value="1.0">
<cfmailparam name="content-type" value='multipart/alternative; boundary="------------7C252360672B03A0BAD013A5"'>
--------------7C252360672B03A0BAD013A5 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit This is the text version. Blah... --------------7C252360672B03A0BAD013A5 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit

<html><body> This is the HTML version.
<IMG src="cid:003a01c11b56$c06b9d20$1a01a8c0@test.com">
</body></html>
 --------------7C252360672B03A0BAD013A5 Content-Type: image/gif; name="myimage.gif" Content-Transfer-Encoding: base64 Content-ID: <003a01c11b56$c06b9d20$1a01a8c0@test.com>
<cffile action="read" file="#expandpath('myimage.gif')#" variable="charData">
<cfset data64 = toBase64(charData)>#data64# --------------7C252360672B03A0BAD013A5-- -- End --

</cfmail>


This code tries to embed the image as inline image but all that I get in mail is garbage (Probably bcos MIME Type setting is changed)

Commented:
your image src must be a full path. (e.g <img src="http://www.abc.com/somefolder/test.gif">). only then u will not need to attach the image to the email. The code u showed is a multipart mail. It sends both plain txt and html mail together. Depending on what the software the user is using, if it can read html, it takes the html portion, else it takes the plain txt portion.
Top Expert 2013

Commented:
This question has been abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
   In the absence of responses, I may recommend DELETE unless it is clear
   to me that it has value as a PAQ.  Silence = you don't care
</note>

Cd&
Top Expert 2013

Commented:
It is time to clean this abandoned question up.  

I am putting it on a clean up list for CS.

<recommendation>
points to elhy

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&

Commented:
Closed as per recommendation

Chmod
Community Support Moderator @Experts Exchange

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial