{"id":152,"date":"2010-05-27T00:00:33","date_gmt":"2010-05-27T04:00:33","guid":{"rendered":"http:\/\/erics-test-lab.com\/?p=152"},"modified":"2010-05-27T00:00:33","modified_gmt":"2010-05-27T04:00:33","slug":"cfmail-tracker-application","status":"publish","type":"post","link":"https:\/\/www.esearing.com\/v2010\/2010\/05\/cfmail-tracker-application\/","title":{"rendered":"CFMail Tracker &#8211; Application"},"content":{"rendered":"<p>Seems like CFMail goes wonky every once in a while and decides not to work. The administrators always blame it on too much mail for the server to handle. So I decided to call them on their &#8220;theory&#8221; and build a tracking tool.<\/p>\n<p>This is a simple tool that merely writes a record to a database every time that the CFMAIL tag is used. I track not only the date and time but the application(tool_name) that sent the mail. You can add your own elements.<\/p>\n<p>Step 1 &#8211; Create the tracker table<br \/>\n<code>CREATE TABLE dbo.CFMail_Tracker<br \/>\n(<br \/>\ntool_name char(20) NULL,<br \/>\nmail_date smalldatetime NULL<br \/>\n) <\/code><\/p>\n<p>Step 2 &#8211; Build the Component that will write the record to the table.<br \/>\n<code><strong>mail_tracker.cfc <\/strong><br \/>\n&lt;cfcomponent&gt;<br \/>\n&lt;cffunction name=\"mailtrack\" access=\"public\" &gt;<br \/>\n&lt;cfargument name=\"tool_name\"  type=\"string\" required=\"true\" default=\"NA\" \/&gt;<br \/>\n&lt;cfquery name=\"insrec\" datasource=\"bmprsql\"&gt;<br \/>\ninsert into CFMAil_Tracker<br \/>\nvalues ('#tool_name#', getDate())<br \/>\n&lt;\/cfquery&gt;<br \/>\n&lt;\/cffunction&gt;<br \/>\n&lt;\/cfcomponent&gt;<\/code><\/p>\n<p>Step 3 &#8211; Add the code to call the cfc.<br \/>\n<code>after &lt;\/cfmail&gt;<br \/>\n&lt;cfinvoke component=\"<em>mail_tracker<\/em>\" method=\"mailtrack\" tool_name=\"<em>tool name here<\/em>\" \/&gt; *<\/code><br \/>\n<span style=\"color: #ff0000;\">* You may have to adjust the path to your mail_tracker.cfc. <\/span>Tool name is the application name or descriptor you wish to track.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Seems like CFMail goes wonky every once in a while and decides not to work. The administrators always blame it on too much mail for the server to handle. So I decided to call them on their &#8220;theory&#8221; and build &hellip; <a href=\"https:\/\/www.esearing.com\/v2010\/2010\/05\/cfmail-tracker-application\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,16,21,14],"tags":[],"class_list":["post-152","post","type-post","status-publish","format-standard","hentry","category-code","category-coldfusion","category-problems-fixes","category-sql"],"_links":{"self":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/152","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/comments?post=152"}],"version-history":[{"count":0,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/152\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/media?parent=152"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/categories?post=152"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/tags?post=152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}