We help IT Professionals succeed at work.

cfmail

karaikudi
karaikudi asked
on
Hi

I tried using cfmail with tags like cfinclude/cfmailparam to send messages with attachment (html page).but the images are missing...
could anyone pls help me to solve this.I'm using cf4.5

thanks


Comment
Watch Question

Yog

Commented:
hey why do you want to use cfinclude indise cfmail ?
Top Expert 2008

Commented:
images are missing from where?  from email?

check the the image tags are fully qualified like:

<img src="http://www.mysite.com/images/image.gif"> and not just <img src="/images/image.gif"> or similar.

cheers.
 

Author

Commented:
Hi meverest

It works.but the clients cannot view the images when they are off-line.Is there any other source/code?
Top Expert 2008
Commented:
well, what you need then is to set the <img> tags to the graphic files that are attached to the message - now this is a little more difficulat, because you need to know the 'content-ID' of the attached files (i am not sure about how cfmail sets the contentID fields)

if you can determine the contentID, then you set image fields like:

<img src="cid:[content-ID string of the associated attachment]">

since i don;t know much about how CF handles attachments, the only way i know of that will work for sure requires that you manually add the UUencoded images to the CFMAIL body and use 'subject line stacking' to add the right headers.

here is an example that works with cfmail even in 4.01:

<cfmail to="#to#" from="#from#" subject="Test Multipart
Subject: test
MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary=#chr(34)#_--------multipart_boundary--------_#chr(34)#">

--_--------multipart_boundary--------_
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

test image below:

[Image]


--_--------multipart_boundary--------_
Content-Type: multipart/related;
 boundary="_--------multipart_boundary_2--------_"


--_--------multipart_boundary_2--------_
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
test image below:
<p><img SRC="cid:part1.some.unique.code" height=21 width=25>
<br>&nbsp;</html>

--_--------multipart_boundary_2--------_
Content-Type: image/gif
Content-ID: <part1.some.unique.code>
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="nsmailRO.gif"

R0lGODlhGQAVAID/AMDAwMQAJiH5BAEAAAAALAAAAAAZABUAQAIghI+pyxcNo5w0WIqz1m+D
7n3hSJamB6Loc4VWesayUgAAOw==
--_--------multipart_boundary_2--------_--

--_--------multipart_boundary--------_--
</cfmail>

take notice of the multipart boundary strings, specified, in particular, the leading and trainling '--'

see also how i have included the image (a small check symbol) as UUEncoded text, and see how the content-ID is referred in the html part.

good luck!

cheers.


Commented:
Okay ppl here is the easy route. What you do is use a cfmailparam and then just link to the images as if they where in that dir. Like so :

<cfmail to="test@no.co.za" subject="Application for Advertisement" from="info@no.co.za" server="test.mail.net" type="HTML">
     <cfmailparam file="#path#checked.gif">
     <table align="center" border="1">
          <tr>
               <td>
                    <img src="checked.gif">
               </td>
          </tr>
     </table>
</cfmail>    

Commented:
cf_advancedemail will do it for you.
http://jochem.vandieten.net/coldfusion/customtags/
Force Accepted

SpideyMod
Community Support Moderator @Experts Exchange

Explore More ContentExplore courses, solutions, and other research materials related to this topic.