{"id":287,"date":"2010-07-14T08:14:21","date_gmt":"2010-07-14T12:14:21","guid":{"rendered":"http:\/\/erics-test-lab.com\/?p=287"},"modified":"2010-07-14T08:14:21","modified_gmt":"2010-07-14T12:14:21","slug":"cfmail-adding-multiple-attachments-with-cfmailparam","status":"publish","type":"post","link":"https:\/\/www.esearing.com\/v2010\/2010\/07\/cfmail-adding-multiple-attachments-with-cfmailparam\/","title":{"rendered":"CFMail Adding multiple attachments with CFMAILPARAM"},"content":{"rendered":"<p>In building a project for work I needed to add potentially multiple attachments to an email. Fortunately, CFMail has a way to add header and additional information.<\/p>\n<p><code>&lt;cfmail to=\"somebody@domain.com\"<br \/>\nfrom = \"yourstruly@domain.com\"<br \/>\nsubject=\"something\"<br \/>\nserver=\"yourmailserver\"&gt;<br \/>\n&lt;p&gt;Here are your attachments.&lt;\/p&gt;<br \/>\n&lt;cfmailparam  file=\"c:\/\/yourpath\/filename.ext\"&gt;<br \/>\n&lt;\/cfmail&gt;<\/code><\/p>\n<p>In coldfusion 8+ you can specify whether the file is an attacment or is displayed inline in the message with disposition=&#8221;inline&#8221; or &#8220;attchment&#8221;. You can also give the file a name with contentID=&#8221;image1&#8243;.<\/p>\n<p>If you need to add cc&#8217;s or other head information you use Name instead of File for the cfmail param. ie name=&#8221;cc&#8221; value=&#8221;bob@hisdomain.com&#8221;<\/p>\n<p>You can pass the values from queries to make the file-name or name-values dynamic. You must use cfloop query=&#8221;queryname&#8221; rather than cfoutput query=&#8221;queryname&#8221;. You can use query references like #queryname.fieldname# if there is only 1 value. If you try to use cfoutput query=queryname you will get an odd message telling you that you can not use nested cfoutput. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>In building a project for work I needed to add potentially multiple attachments to an email. Fortunately, CFMail has a way to add header and additional information. &lt;cfmail to=&#8221;somebody@domain.com&#8221; from = &#8220;yourstruly@domain.com&#8221; subject=&#8221;something&#8221; server=&#8221;yourmailserver&#8221;&gt; &lt;p&gt;Here are your attachments.&lt;\/p&gt; &lt;cfmailparam file=&#8221;c:\/\/yourpath\/filename.ext&#8221;&gt; &hellip; <a href=\"https:\/\/www.esearing.com\/v2010\/2010\/07\/cfmail-adding-multiple-attachments-with-cfmailparam\/\">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,24],"tags":[],"class_list":["post-287","post","type-post","status-publish","format-standard","hentry","category-code","category-coldfusion","category-problems-fixes","category-snippets-quick-code-tips-for-single-elements-attributes-or-details"],"_links":{"self":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/287","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=287"}],"version-history":[{"count":0,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/287\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/media?parent=287"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/categories?post=287"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/tags?post=287"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}