{"id":31396,"date":"2018-04-21T15:47:46","date_gmt":"2018-04-21T15:47:46","guid":{"rendered":"https:\/\/ampscript.guide\/attachfile\/"},"modified":"2021-04-06T01:18:22","modified_gmt":"2021-04-06T01:18:22","slug":"attachfile","status":"publish","type":"post","link":"https:\/\/ampscript.guide\/attachfile\/","title":{"rendered":"AttachFile"},"content":{"rendered":"<h2>AttachFile<\/h2>\n<p>This function attaches the specified file to the outbound message or displays a link to the file when included in a landing page. This function returns no output.<\/p>\n<h3>Arguments<\/h3>\n<p><code>AttachFile(1,2,3,4,5,6,7,8)<\/code><\/p>\n<table>\n<colgroup>\n<col style=\"width: 6%\">\n<col style=\"width: 6%\">\n<col style=\"width: 6%\">\n<col style=\"width: 80%\"><\/colgroup>\n<thead>\n<tr class=\"header\">\n<th style=\"text-align: center\">Ordinal<\/th>\n<th style=\"text-align: left\">Type<\/th>\n<th style=\"text-align: left\">Required<\/th>\n<th style=\"text-align: left\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr class=\"odd\">\n<td style=\"text-align: center\">1<\/td>\n<td style=\"text-align: left\">String<\/td>\n<td style=\"text-align: left\">True<\/td>\n<td style=\"text-align: left\">\n<p>Type of location containing the file to attach. Valid values include:<\/p>\n<ul>\n<li><code>ContentBuilder<\/code><\/li>\n<li><code>FTP<\/code><\/li>\n<li><code>HTTP<\/code><\/li>\n<li>\n<code>Portfolio<\/code> (Classic Content)<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<tr class=\"even\">\n<td style=\"text-align: center\">2<\/td>\n<td style=\"text-align: left\">String<\/td>\n<td style=\"text-align: left\">True<\/td>\n<td style=\"text-align: left\">\n<p>Path or key of the asset to attach. Specify the following for the preceding location:<\/p>\n<ul>\n<li>\n<code>ContentBuilder<\/code> &#8211; Customer\/External Key of asset<\/li>\n<li>\n<code>FTP<\/code> &#8211; Name of file in the Enhanced SFTP <code>Import<\/code> Folder<\/li>\n<li>\n<code>HTTP<\/code> &#8211; HTTP\/HTTPS URL of the asset<\/li>\n<li>\n<code>Portfolio<\/code> &#8211; Customer\/External Key of asset in Classic Content<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<tr class=\"odd\">\n<td style=\"text-align: center\">3<\/td>\n<td style=\"text-align: left\">String<\/td>\n<td style=\"text-align: left\">False<\/td>\n<td style=\"text-align: left\">\n<p>Alias assigned to file when attached. If no value is specified, the name of the file is used.<\/p>\n<p>If you do not specify an alias for <code>HTTP<\/code> type asset, the <code>Content-Disposition<\/code> from the HTTP header will be used. If no <code>Content-Disposition<\/code> is provided, a system-generated value will be returned.<\/p>\n<\/td>\n<\/tr>\n<tr class=\"even\">\n<td style=\"text-align: center\">4<\/td>\n<td style=\"text-align: left\">Boolean<\/td>\n<td style=\"text-align: left\">False<\/td>\n<td style=\"text-align: left\">\n<p>Show link to file in the <em>View as a Web Page<\/em> context. Default value is <code>false<\/code>.<\/p>\n<p>This argument can only be used with the <code>HTTP<\/code> location type.<\/p>\n<\/td>\n<\/tr>\n<tr class=\"odd\">\n<td style=\"text-align: center\">5<\/td>\n<td style=\"text-align: left\">String<\/td>\n<td style=\"text-align: left\">False<\/td>\n<td style=\"text-align: left\">\n<p>URL of the attachment to use in the <em>View as a Web Page<\/em> context. Default value is <code>false<\/code>.<\/p>\n<p>This argument can only be used with the <code>HTTP<\/code> location type.<\/p>\n<\/td>\n<\/tr>\n<tr class=\"even\">\n<td style=\"text-align: center\">6<\/td>\n<td style=\"text-align: left\">String<\/td>\n<td style=\"text-align: left\">False<\/td>\n<td style=\"text-align: left\">\n<p>Link name for file in the <em>View as a Web Page<\/em> context.<\/p>\n<p>This argument can only be used with the <code>HTTP<\/code> location type.<\/p>\n<\/td>\n<\/tr>\n<tr class=\"odd\">\n<td style=\"text-align: center\">7<\/td>\n<td style=\"text-align: left\">Number<\/td>\n<td style=\"text-align: left\">False<\/td>\n<td style=\"text-align: left\">\n<p>Number of days the link to download the file appears in the <em>View as a Web Page<\/em> context.<\/p>\n<p>This argument can only be used with the <code>HTTP<\/code> location type.<\/p>\n<\/td>\n<\/tr>\n<tr class=\"even\">\n<td style=\"text-align: center\">8<\/td>\n<td style=\"text-align: left\">Boolean<\/td>\n<td style=\"text-align: left\">False<\/td>\n<td style=\"text-align: left\">\n<p>When this <i>force_attachment<\/i> indicator is <code>true<\/code>, the [content-disposition](https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Headers\/Content-Disposition) of the file is set to <i>attachment<\/i>.  When <code>false<\/code>, the content-disposition is set to <i>inline<\/i>.  Default is <code>false<\/code> for <i>inline<\/i>, with some exceptions noted in the table below.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<blockquote>\n<p>NOTE: Arguments 4 &ndash; 7 are unavailable in the current release of Marketing Cloud. This should be resolved in a future release.<\/p>\n<\/blockquote>\n<p>Files of the following MIME types can be attached to email messages in Marketing Cloud:<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left\">Extension<\/th>\n<th style=\"text-align: left\">MIME Type<\/th>\n<th style=\"text-align: left\">Default Content-Disposition<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left\"><code>.csv<\/code><\/td>\n<td style=\"text-align: left\"><code>text\/csv<\/code><\/td>\n<td style=\"text-align: left\"><code>attachment<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.doc<\/code><\/td>\n<td style=\"text-align: left\"><code>application\/msword<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.docm<\/code><\/td>\n<td style=\"text-align: left\"><code>application\/vnd.ms-word.document.macroEnabled.12<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.docx<\/code><\/td>\n<td style=\"text-align: left\"><code>application\/vnd.openxmlformats-officedocument.wordprocessingml.document<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.gif<\/code><\/td>\n<td style=\"text-align: left\"><code>image\/gif<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.htm<\/code><\/td>\n<td style=\"text-align: left\"><code>text\/html<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.html<\/code><\/td>\n<td style=\"text-align: left\"><code>text\/html<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.ics<\/code><\/td>\n<td style=\"text-align: left\"><code>application\/ics<\/code> or <code>text\/calendar<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.jpeg<\/code><\/td>\n<td style=\"text-align: left\"><code>image\/jpeg<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.jpg<\/code><\/td>\n<td style=\"text-align: left\"><code>image\/jpeg<\/code> or <code>image\/jpg<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.mp4<\/code><\/td>\n<td style=\"text-align: left\"><code>video\/mp4<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.pdf<\/code><\/td>\n<td style=\"text-align: left\"><code>application\/pdf<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.pkpass<\/code><\/td>\n<td style=\"text-align: left\"><code>application\/vnd.apple.pkpass<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.png<\/code><\/td>\n<td style=\"text-align: left\"><code>image\/png<\/code> or <code>image\/x-png<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.ppt<\/code><\/td>\n<td style=\"text-align: left\"><code>application\/vnd.ms-powerpoint<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.pptx<\/code><\/td>\n<td style=\"text-align: left\"><code>application\/vnd.openxmlformats-officedocument.presentationml.presentation<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.rar<\/code><\/td>\n<td style=\"text-align: left\"><code>application\/x-rar-compressed<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.rtf<\/code><\/td>\n<td style=\"text-align: left\"><code>application\/rtf<\/code> or <code>text\/rtf<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.tif<\/code><\/td>\n<td style=\"text-align: left\"><code>image\/tiff<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.tiff<\/code><\/td>\n<td style=\"text-align: left\"><code>image\/tiff<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.txt<\/code><\/td>\n<td style=\"text-align: left\"><code>text\/plain<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.vcf<\/code><\/td>\n<td style=\"text-align: left\"><code>text\/vcard<\/code> or <code>text\/x-vcard<\/code><\/td>\n<td style=\"text-align: left\"><code>attachment<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.wav<\/code><\/td>\n<td style=\"text-align: left\"><code>audio\/wav<\/code> or <code>audio\/x-wav<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.xls<\/code><\/td>\n<td style=\"text-align: left\"><code>application\/vnd.ms-excel<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.xlsx<\/code><\/td>\n<td style=\"text-align: left\"><code>application\/vnd.openxmlformats-officedocument.spreadsheetml.sheet<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.xml<\/code><\/td>\n<td style=\"text-align: left\"><code>application\/xml<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.xml<\/code><\/td>\n<td style=\"text-align: left\"><code>text\/xml<\/code><\/td>\n<td style=\"text-align: left\"><code>attachment<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\"><code>.zip<\/code><\/td>\n<td style=\"text-align: left\"><code>application\/x-zip-compressed<\/code> or <code>application\/zip<\/code><\/td>\n<td style=\"text-align: left\"><code>inline<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<blockquote>\n<p>NOTE: Marketing Cloud Support must provision this function for use in your account.  There is typically an additional charge per attachment sent. Contact your Salesforce Account Executive to complete the process.<\/p>\n<p>NOTE: If the specified file cannot be found at send time, the send will throw a runtime error and abort.<\/p>\n<p>NOTE: If you are attaching an external file and the remote server does not respond within 30 seconds, the send will be scheduled to retry 15 minutes later.<\/p>\n<p>NOTE: Local assets in shared Content Builder or Portfolio locations are not supported.<\/p>\n<p>NOTE: MIME types <code>text\/csv<\/code>, <code>application\/xml<\/code>, <code>text\/xml<\/code>, <code>text\/vcard<\/code> and <code>text\/x-vcard<\/code> have a default content-disposition of <code>attachment<\/code>, that cannot be overridden.<\/p>\n<\/blockquote>\n<h3>Example 1<\/h3>\n<p>This example attaches a Content Builder asset by Customer\/External Key:<\/p>\n<pre><code>%%[\n\nvar @customerKey, @fileAlias\nset @customerKey = \"LoyaltyMembersCB\"\nset @fileAlias = \"LoyaltyMembers_ContentBuilder.zip\"\n\nAttachFile(\"ContentBuilder\", @customerKey, @fileAlias)\n\n]%%<\/code><\/pre>\n<h3>Example 2<\/h3>\n<p>This example attaches a file from the Marketing Cloud <code>Import<\/code> folder:<\/p>\n<pre><code>%%[\n\nvar @fileName, @fileAlias\nset @fileName = \"LoyaltyMembers.zip\"\nset @fileAlias = \"LoyaltyMembers_FTP.zip\"\n\nAttachFile(\"FTP\", @fileName, @fileAlias)\n\n]%%<\/code><\/pre>\n<h3>Example 3<\/h3>\n<p>This example attaches a file from an external website via HTTP\/HTTPS:<\/p>\n<pre><code>%%[\n\nvar @fileName, @fileAlias\nset @fileName = \"https:\/\/limedash.com\/drop\/LoyaltyMembers.zip\"\nset @fileAlias = \"LoyaltyMembers.zip\"\n\nAttachFile(\"HTTP\", @fileName, @fileAlias)\n\n]%%<\/code><\/pre>\n<h3>Example 4<\/h3>\n<p>This example attaches a file from the Portfolio asset by Customer\/External Key:<\/p>\n<pre><code>%%[\n\nvar @externalKey, @fileAlias\nset @externalKey = \"LoyaltyMembers\"\nset @fileAlias = \"LoyaltyMembers_Portfolio.zip\"\n\nAttachFile(\"Portfolio\", @externalKey, @fileAlias)\n\n]%%\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>AttachFile This function attaches the specified file to the outbound message or displays a link to the file when included in a landing page. This function returns no output. Arguments AttachFile(1,2,3,4,5,6,7,8) Ordinal Type Required Description 1 String True Type of location containing the file to attach. Valid values include: ContentBuilder FTP HTTP Portfolio (Classic Content) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v14.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>The AMPscript Guide - AttachFile<\/title>\n<meta name=\"robots\" content=\"index, follow\" \/>\n<meta name=\"googlebot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta name=\"bingbot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ampscript.guide\/attachfile\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The AMPscript Guide - AttachFile\" \/>\n<meta property=\"og:description\" content=\"AttachFile This function attaches the specified file to the outbound message or displays a link to the file when included in a landing page. This function returns no output. Arguments AttachFile(1,2,3,4,5,6,7,8) Ordinal Type Required Description 1 String True Type of location containing the file to attach. Valid values include: ContentBuilder FTP HTTP Portfolio (Classic Content) [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ampscript.guide\/attachfile\/\" \/>\n<meta property=\"og:site_name\" content=\"The AMPscript Guide\" \/>\n<meta property=\"article:published_time\" content=\"2018-04-21T15:47:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-04-06T01:18:22+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ampscript.guide\/#website\",\"url\":\"https:\/\/ampscript.guide\/\",\"name\":\"The AMPscript Guide\",\"description\":\"The Definitive Scripting Manual for Salesforce Marketing Cloud\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/ampscript.guide\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ampscript.guide\/attachfile\/#webpage\",\"url\":\"https:\/\/ampscript.guide\/attachfile\/\",\"name\":\"The AMPscript Guide - AttachFile\",\"isPartOf\":{\"@id\":\"https:\/\/ampscript.guide\/#website\"},\"datePublished\":\"2018-04-21T15:47:46+00:00\",\"dateModified\":\"2021-04-06T01:18:22+00:00\",\"author\":{\"@id\":\"https:\/\/ampscript.guide\/#\/schema\/person\/5335042f77731e84f9808aecef25daec\"},\"breadcrumb\":{\"@id\":\"https:\/\/ampscript.guide\/attachfile\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ampscript.guide\/attachfile\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ampscript.guide\/attachfile\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ampscript.guide\/\",\"url\":\"https:\/\/ampscript.guide\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ampscript.guide\/attachfile\/\",\"url\":\"https:\/\/ampscript.guide\/attachfile\/\",\"name\":\"AttachFile\"}}]},{\"@type\":[\"Person\"],\"@id\":\"https:\/\/ampscript.guide\/#\/schema\/person\/5335042f77731e84f9808aecef25daec\",\"name\":\"dev\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","_links":{"self":[{"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/posts\/31396"}],"collection":[{"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/comments?post=31396"}],"version-history":[{"count":0,"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/posts\/31396\/revisions"}],"wp:attachment":[{"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/media?parent=31396"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/categories?post=31396"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ampscript.guide\/wp-json\/wp\/v2\/tags?post=31396"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}