Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cfmail and a read confirmation 1

Status
Not open for further replies.

daNewfie

Programmer
Oct 14, 2004
258
CA
I am sending emails to members in my database via cfmail and I was wondering if there was any code I could actually include that would tell me of the email has actually been opened or anything like that...

Craig
 
Try this:
Code:
<cfmail to="test@example.com" 
        from="test@example.com" 
        subject="test read receipt">
  <cfmailparam name="Read-Receipt-To" value="test@example.com">
  <cfmailparam name="Disposition-Notification-To" value="test@example.com">
  This is a test for read receipts.
 </cfmail>
Here's where I got it:



Hope This Helps!

ECAR
ECAR Technologies, LLC

"My work is a game, a very serious game." - M.C. Escher
 
hmmm
I was looking at it...this is almost but not quite what I needed...

This, I assume will prompt the reader to send a read request...

I want to be able to know if an email has been read with any sort of acknowledgment from the reader...
almost like putting a cfquery in the cfmail and when its opened the running an update to a database


Craig
 
Ok, try this. It uses an image imbedded in the email, you can make it a 1x1 clear gif if you want to, just as long as the image code is there. I wish I could give credit for it, but I don't remember where I got it. It's just something I had laying around in my "toolbox". :)
Code:
In the CFM page that's calling CFMAIL, do something like:

<cfmail to="#ToAddress#" from="#FromAddress#" subject="Test, please open" type="HTML">
<html>
<body>
<img src="[URL unfurl="true"]http://yourserver/trackingimage.cfm?email=#URLEncodedFormat(FromAddress)#"[/URL] width="1" height="1" alt="" border="0" />

This is the body of the email.

Whatever whatever

</body>
</html>
</cfmail>


Then, on your server, you place a CFM page called trackingimage.cfm (which, if you notice, is called from an IMG tag in the email message) which has the following code:

<CFCONTENT type="image/gif">
<img src="/images/spacer.gif">           
<CFPARAM name="URL.email" default="">

<CFSET decodedEmail = URLDecode(URL.email)>
<CFMAIL to="#admin_address#" from="nobody" subject="email read">

    The addressee #decodedEmail# read their email at #DateFormat(Now(),"yyyy/mm/dd")# #TimeFormat(Now(),"HH:mm tt")#.

</CFMAIL>


This works on all clients that are HTML-capable (which is generally a lot more than those that support read receipts), and works whether they have their servers/inboxes set up to allow read receipts or not.



Hope This Helps!

ECAR
ECAR Technologies, LLC

"My work is a game, a very serious game." - M.C. Escher
 
Hi daNewfie,

I don't know if mail clients can except it or not, but if your recipients can accept HTML emails you might be able to place an <iframe> or something similiar within the email, that intern links to a page on your server to records the 'opening' of the email. For example:

Code:
	<!--- HTML Email --->
	This is some email text...
	...
	<iframe src="[URL unfurl="true"]http://www.mydomain.com/recordAcceptance.cfm?clientID=123456"[/URL] width="1" height="1">

Code:
	<!--- RecordAcceptance.cfm --->
	<cfquery name="myQuery" datasource="myDataSource">
		UPDATE T_EmailAcceptanceLog
		SET openedEmail = 1
		WHERE clientID = 123456
	</cfquery>

The variable client ID could be the users email address, ect... I would be careful using a method like this only because I know that a lot of people (myself included) do not accept HTML emails, only plain text. Not to mention, some mail clients might not render the <iframe> tag or accept the email if it violates its spam policies.

Hope this helps,

jalpino
 
I have one more question to ask that hopefully will stay on topic of this thread. If I email say 200 members at once and lets say some are bad emails. Lets say the 10th email spooled was bad, will the remaining 190 after that still go? Or will the bad email stop the process?

----------------------------------------
Florida Web Design
Orlando Web Hosting
Florida Coldfusion Hosting
 
I think they will continue on...I sent out 150 email yesterday and I cc: myself on them....I got all 150 copies..and I know they were individual emails cause the name of the recipient was embedded in each email...


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top