SpreadWebServcie.CreateCampaign Method

 

创建一个电子邮件活动和发送.

public int createCampaign (

string loginEmail,

string password,

Campaign campaignArgs,

string[] category,

int interval

)

参数

参数

类型

描述

loginEmail

String

Spread账号的登录邮件地址.

password

String

Spread账号的登录密码或者 API Key.

campaignArgs

campaign

要被创建的campaign对象.

category

String[]

这个邮件活动发送到联系人名单的名称.

*interval

Integer

邮件活动的类型.

interval=-1, 电子邮件只被发送一次.

interval>=0,电子邮件将在一个订户订阅N天后被发送.

返回结果

Integer 被创建活动的ID

下表列出了详细的返回情况

状态/场景

返回类型

返回信息

成功创建群发邮件活动 Integer

被创建活动的ID,值大于0。

请求该API时"loginEmail"或者"password"错误。 Exception

返回异常包含错误信息 'LoginEmail and Password do not match!'。

请求该API时使用无效的"fromEmail",该邮箱未被添加为发件人。 Exception

返回异常包含错误信息 'Email 'fromEmail' has not been verified yet!'。

请求该API时使用无效的"Interval",其值小于 -1。 Exception

返回异常包含错误信息 'Invalid Interval! Note: -1, campaign send for once only. Non-negetive number, n days after subscribers subscribe. please retry with other campaign name '。

请求该API时使用已被使用的活动名称。 Exception

返回异常包含错误信息 'CampaignName existed!'。

请求该API时使用未添加的联系人名单。 Exception

返回异常包含错误信息 'ContactList categoryName is not exist!'。

其他异常 Exception

返回包含错误信息的异常。

创建群发邮件活动失败 Integer

返回小于等于0的值

例子

string loginName = "spread@reasonables.com";

string loginPassword = "spread";

 

//Create an array of target subscriptions

string[] targetSubscriptions = new string[2];

targetSubscriptions[1] = "NoClone VIP";

targetSubscriptions[2] = "Spread VIP";

 

int interval = -1;

int campaignID;

 

//Create a Campaign object

Campaign myCampaign = new Campaign();
myCampaign.campaignName
= "NoClone Promotion";

myCampaign.from = "NoClone";

myCampaign.fromEmail = "noclone@reasonables.com";

myCampaign.subject = "NoClone 4 is released!";

myCampaign.content = "Download NoClone 4 at http://noclone.net now!";

// suggest dateTime string format "dd MMM yyyy HH:mm:ss" ,such as "22 Feb 2013 12:11:21" .
myCampaign.schedule = "22 Feb 2013 12:11:21";

 

//Create a SpreadWebService object and use its method.

SpreadWebService MySpread = new SpreadWebService();

 

campaignID = MySpread.createCampaign (loginName, loginPassword, myCampaign, targetSubscriptions, interval);

参见

SpreadWebService Class | Spread Web Service Namespace

Campaign Class