SpreadWebServcie.SendTemplateAttachments Method

 

使用模板發送單個郵件,並可以携帶一個附件。

注:聯系人將自動加入“Auto_+當前時間“的聯系人列表,此函數允許重複發送,所以對應名單可能會出現重複聯系人.請勿在其他郵件使用該聯系人列表,以防止郵件重複發送。

public String SendTemplateAttachments (

string LoginEmail,

string APIKey,

string To,

string TemplateId,

string Subject,

string SubstitutionVars,

string CreativeLanguage

CampaignAttachment() files

)

參數

參數

類型

描述

LoginEmail

String

Spread賬號的登錄郵箱。

APIKey

String

Spread賬號的密碼或者API Key

To

String

收件者的郵箱地址。

TemplateId

String

TemplateId,實際上就是CampaignID。

Subject

String

郵件的主題。

SubstitutionVars

String

自定義標簽,Json格式,如:若在Campaign裏面有一個標簽叫[CUSTOM],那麽便傳入參數:{"[CUSTOM]":"Value"}。

CreativeLanguage

String

Creative的語言代碼,如:en,en-us,zh-tw,zh-cn

fils

CampaignAttachment()

附件對象數組。

返回結果

String 表示郵件發送的結果。"Sent success" 表示成功,其他表示失败。

例子

string LoginEmail = "spread@reasonables.com" ;

string APIKey = "spread" ;

 

//Define recipient email

string To = "noclone@reasonables.com" ; 

 

  //Content Information

string TemplateId = "1" ;

string Subject = "Title" ;

string SubstitutionVars = "{\"[CUSTOM]\":\"Value\"}" ;

 

//Language Information

string CreativeLanguage = "en" ; 

 

//Attachment Information

SpreadWebService. CampaignAttachment[] files = new SpreadWebService. CampaignAttachment [2];

 

SpreadWebService. CampaignAttachment AttachmentA = new SpreadWebService. CampaignAttachment ();

AttachmentA.file = File .ReadAllBytes( "Desktop/FileA.txt" )

AttachmentA.fileType = ".jpg" ; 

AttachmentA.displayName = "FileA.jpg" ; 

 

SpreadWebService. CampaignAttachment AttachmentB = new SpreadWebService. CampaignAttachment ();

AttachmentB.file = File .ReadAllBytes( "Desktop/FileB.txt" )

AttachmentB.fileType = ".jpg" ; 

AttachmentB.displayName = "FileB.jpg" ; 

 

files[0] = AttachmentA ; 

files[1] = AttachmentB ; 

 

//Create a SpreadWebService object and use its method.

SpreadWebService MySpread = new SpreadWebService ();

string result = MySpread.SendTemplateAttachments(LoginEmail,APIKey,To,TemplateId,
Subject,SubstitutionVars,CreativeLanguage,files);

參見

SpreadWebService Class | Spread Web Service Namespace

Campaign Class