我正在研究如何使用确切的目标来发送电子邮件附件:(可以是多个)
http://help.exacttarget.com/en-US/documentation/exacttarget/content/email_attachments/
我不能像下面的指令那样硬编码:
%%=AttachFile("Portfolio","Example1")=%%
%%=AttachFile("Portfolio","Example2")=%%
%%=AttachFile("Portfolio","Example3")=%%
%%=AttachFile("Portfolio","Example4")=%%
%%=AttachFile("Portfolio","Example5")=%%因为我需要发送的附件数量各不相同。
有没有人知道我如何通过编程实现这一点?
非常感谢!
发布于 2014-12-08 15:41:07
%%如果为Condition1,则%%
%%=AttachFile("Portfolio","Example1")=%%
%%ELSEIF如果Condition2,则%%
%%=AttachFile("Portfolio","Example1")=%%
%%=AttachFile("Portfolio","Example2")=%%
%%ELSEIF如果Condition3,则%%
%%=AttachFile("Portfolio","Example3")=%%
%%ELSEIF如果Condition4,则%%
%%=AttachFile("Portfolio","Example3")=%%
%%=AttachFile("Portfolio","Example4")=%%
%%ELSEIF如果Condition5,则%%
%%=AttachFile("Portfolio","Example1")=%%
%%=AttachFile("Portfolio","Example5")=%%
%%否则ENDIF%%
发布于 2014-12-19 04:45:22
有关AMPScript中附件功能的更深入信息的快速link
实际上,我能想到的没有更多信息的最好方法是在数据扩展中包括“附件1”、“附件2”等字段,并用位置填充这些字段,然后将位置作为变量包含在附件文件中。
例如%%=AttachFile("Portfolio",附件1)=%%
然后只需使用条件,如IF Not EMPTY()等,来决定应该执行哪些函数。
这样,您可以动态编辑每个收件人的位置以及调用AttachFile的次数。这是一个有点混乱和笨拙,但再次没有更多的信息,这是我能做的最好的。
发布于 2015-03-05 00:10:58
你怎么知道附件的数量?这是已知的预发送还是直到发送时间?这是触发发送还是用户发起的?
根据这些答案,您可以通过几种方式来实现这一点。
我要探索的主要解决方案路径是执行某种类型的LookupRows()或LookupOrderedRows()来检索要附加的文件,然后遍历这些行并附加文件。此外,重要的是要注意,AttachFile()函数需要在内联AMP脚本中执行,%%=AttachFile()= %%,而不是在AMP代码块中执行,%% ......%%。
因此,您的代码可能如下所示(我包含了一个托管在外部站点、ET FTP和项目组合上的文件的示例):
%%[ VAR @sub, @fileDe, @files, @file, @fileUrl, @fileName, @fileExternalKey
SET @sub = [_subscriberkey]
SET @fileDE = "Name Data Extension holding attachment filename/url"
/*LookupRows() from DE. Assumes data extension uses SubscriberKey as the foreign key*/
SET @files = LookupRows(@fileDe,"SubscriberKey",@sub)
/*Validate files were returned*/
IF Rowcount(@files) > 0 THEN
FOR @i = 1 TO Rowcount(@files) DO
SET @file = Row(@files,@i)
/*If you are using files hosted at an external HTTP/HTTPS location*/
SET @fileUrl = Field(@file,"FileURL")
]%%
%%=AttachFile("HTTP",@fileUrl)=%%
%%[
/*If you are using files hosted in the Import folder of the ExactTarget FTP*/
SET @fileName = Field(@file,"FileName")
]%%
%%=AttachFile("FTP",@fileName)=%%
%%[
/*If you are using files hosted in the ExactTarget Portfolio*/
SET @fileName = Field(@file,"PortfolioFileExternalKey")
]%%
%%=AttachFile("Portfolio",@fileExternalKey)=%%
%%[
NEXT @i
ELSE
/*No records returned for @files*/
ENDIF
]%%https://stackoverflow.com/questions/27325825
复制相似问题