0

我正在研究如何使用精确目标发送电子邮件附件:(可能是多个)

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")=%%

因为我需要发送的附件数量不同。

有谁知道我如何以编程方式实现这一目标?

非常感谢!

4

3 回答 3

0

你怎么知道附件的数量?这是已知的预发送还是直到发送时间?这是触发发送还是用户启动?

根据这些答案,您可以通过多种方式实现这一目标。

我将探索的主要解决方案路径是执行某种 LookupRows() 或 LookupOrderedRows() 来检索要附加的文件,然后遍历这些行并附加文件。另外,需要注意的是 AttachFile() 函数需要在 inline-AMP Script 中执行,%%=AttachFile()=%%,而不是在 AMP 代码块中,%%[ ...... ]%%。

因此,您的代码可能类似于以下内容(我包含了托管在外部站点、ET FTP 和 Portfolio 上的文件示例):

%%[ 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
]%%
于 2015-03-04T16:10:58.317 回答
0

快速链接到有关 AMPScript 中附件功能的更深入信息

在没有更多信息的情况下,我能想到的最好的方法是在数据扩展中包含“附件 1”、“附件 2”等字段,并用位置填充这些字段,然后将位置作为变量包含在附件文件中.

例如 %%=AttachFile("Portfolio",[附件 1])=%%

然后只使用 IF Not EMPTY() 等条件来决定应该执行哪些函数。

这样,您可以在每个收件人之间动态编辑位置以及调用 AttachFile 的次数。这有点凌乱和麻烦,但再次没有更多信息,这是我能做的最好的。

于 2014-12-18T20:45:21.900 回答
0

%%[IF Condition1 THEN]%%
%%=AttachFile("Portfolio","Example1")=%%

%%[ELSEIF Condition2 THEN]%%
%%=AttachFile("Portfolio","Example1")=%%
%%=AttachFile("Portfolio","Example2")=%%

%%[ELSEIF Condition3 THEN]%%
%%=AttachFile("Portfolio","Example3")=%%

%%[ELSEIF Condition4 THEN]%%
%%=AttachFile("Portfolio","Example3")=%%
%%=AttachFile("Portfolio","Example4")=%%

%%[ELSEIF Condition5 THEN]%%
%%=AttachFile("Portfolio", "Example1")=%%
%%=AttachFile("Portfolio","Example5")=%%

%%[ELSE ENDIF]%%

于 2014-12-08T07:41:07.013 回答