Skip Navigation Links.
展开 最小化

SpreadWebServcie.CreateCampaign2 Method

创建群发邮件的高级方法
public int createCampaign2(
 string loginEmail,
 string password,
 string campaignName,
 CampaignCreatives campaignCreatives[],
 string category[],
 int interval, 
 DateTime schedule, 
 string signature, 
 CampaignStatus campaignStatus
 )
 Public Function createCampaign2(
 ByVal loginEmail As String,
 ByVal password As String,
 ByVal campaignName As String,
 ByVal campaignCreatives() As CampaignCreatives,
 ByVal category() As String,
 ByVal interval As Integer, 
 ByVal schedule As Date, 
 ByVal signature As String, 
 ByVal campaignStatus As CampaignStatus) As Integer
No sample for PHP.
No sample.

参数

参数

类型

描述

loginEmail

String

你的思齐账号

password

String

API密钥或者密码 API Key 可在平台登陆后我的账号查看(我的账号=> 应用程序接口).

campaignName

String

活动名称会在我们平台显示已供你参考

CampaignCreatives

Creative[]

Creative数组 Creative

category

String[]

联系人名单的名称

interval

Integer

活动类型

interval=-1邮件只发生一次(不重复)

interval>=0邮件将在订阅后N天发送

schedule

DateTime

电子邮件活动的计划发送时间。
推荐日期格式:yyyy-MM-ddTHH:mm:ss,比如 '2016-08-22T12:11:21' (活动状态设置为等待)
时区:UTC +08:00。

signatureTag

String

添加本次邮件活动的标记, 注:不是邮件正文的签名

campaignStatus

CampaignStatus

等待或者草稿,等待状态的邮件不会发出去直到定时任务时间到了才发

返回结果

Integer 如果成功则返回大于0的活动ID

例子

	string loginEmail = "spread@reasonables.com";
	string loginPassword = "API KEY";
	string campaignName = "The Name will display in our platform";
	int interval = -1; //-1 send at once or n days later
	DateTime schedule = DateTime.Now;
	string[] category = { "General-VIPME-4", "luohaihao&romeqaz" }; //contact list 
	var campaignStatus = SpreadWS.CampaignStatus.Waiting;

	var creative = new SpreadWS.CampaignCreatives(); //creative is the mail content , define below
	creative.displayName = "ReasonableTech"; //sender name
	creative.fromAddress = "autoedm@reasonable.com";
	creative.subject = "Learn Spread API";
	creative.creativeContent = "Make your own applications with SpreadWS";
	creative.isCampaignDefault = true; //indicate default if there's multi creative
	creative.replyTo = "hoyho@foxmail.com";
	creative.target = "D"; //indicate this campaign is desktop version
	var campaignCreatives = new[] { creative }; //campaignCreatives is array of creative ,if you want to sent more creative in one campaign,set value of campaignCreatives

	var ws = new SpreadWS.Service();
	int campaignId = ws.createCampaign2(loginEmail, loginPassword, campaignName, campaignCreatives, category, interval, schedule, "spread", campaignStatus);
	return campaignId;
	Dim loginEmail As String = "spread@reasonables.com"
	Dim loginPassword As String = "API KEY"
	Dim campaignName As String = "The Name will display in spread platform"
	Dim interval As Integer = -1 '-1 send at once or n days later
	Dim schedule As DateTime = DateTime.Now
	Dim category As String() = {"General-VIPME-4", "luohaihao&romeqaz"} 'contact list 
	Dim status As SpreadWS.CampaignStatus = SpreadWS.CampaignStatus.Waiting

	Dim creative As SpreadWS.CampaignCreatives = New SpreadWS.CampaignCreatives()  'creative is the mail content , define as below
	With creative
		.creativeContent = "Make your own applications with SpreadWS"
		.displayName = "ReasonableTech"  'sender name
		.fromAddress = "autoedm@reasonable.com"
		.isCampaignDefault = True
		.replyTo = "hluo@reasonables.com"
		.subject = "Learn Spread API"
		.target = "D"  'indicate this campaign is DeskTop version
	End With
	Dim campaignCreative(0) As SpreadWS.CampaignCreatives
	campaignCreative(0) = creative 'campaignCreatives is array of creative ,if you want to sent more creative in one campaign,set value of campaignCreatives

	Dim client As SpreadWS.Service = New SpreadWS.Service()
	Dim campaignId As Integer = client.createCampaign2(loginEmail, loginPassword, campaignName, campaignCreative, category, interval, schedule, "spread", status)
function CreateCampaign2(){
          
        $loginEmail "spread@reasonables.com";
        $password 'API KEY';
        $category array('luohaihao&romeqaz','General-VIPME-4');  //ContactList
        $interval = -1; // -1 send at once,can set to n days later
        $schedule = time();
        $campaignStatus 'Waiting'//Waiting or Draft  ,wait until schedule time
        $campaignName "The Name will display in spread platform (php)";
  
        $creative array(
        'subject'  =>'Learn Spread API',      
        'creativeContent'  =>'Make your own applications with SpreadWS',            
        'displayName'  =>'ReasonableTech',                                     
        'fromAddress'  =>'autoedm@reasonable.com',                                          
        'target'  =>'D',  //indicate this creative is desktop version
        'isCampaignDefault'  =>True, //indicate default if there's multi creatives to se
        'replyTo'  =>'hoyho@foxmail.com'                         
        );
  
        $campaignCreatives array($creative);
  
        $campaignArgs array(
            'loginEmail'    => $loginEmail,
            'password'  => $password,
            'campaignName' => $campaignName,
            'campaignCreatives' => $campaignCreatives,
            'category'  => $category,
            'interval'  => $interval,
            'schedule'  => $schedule,
            'signature' => "spread remark",
            'campaignStatus' => $campaignStatus
        );
        $Client=new SoapClient("http://service1.rspread.com/Service.asmx?WSDL");
        $cpnId $Client -> createCampaign2( $campaignArgs );  //campaignID
        echo serialize($cpnId);
        //echo ($cpnId);
    }
    
POST {{YOUR_API_URL}}/service.asmx 

Content-Type: application/soap+xml; charset=utf-8
Content-Length: {{length}}

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <createCampaign2 xmlns="http://service.reasonablespread.com/">
      <loginEmail>spread@reasonables.com</loginEmail>
      <password>TEST0000-TEST-0000-TEST-0000TEST0000</password>
      <campaignName>The Name will display in our platform</campaignName>
      <campaignCreatives>
        <CampaignCreatives>
          <subject>Learn Spread API</subject>
          <displayName>ReasonableTech</displayName>
          <fromAddress>autoedm@reasonable.com</fromAddress>
          <replyTo>hoyho@foxmail.com</replyTo>
          <creativeContent>Make your own applications with SpreadWS</creativeContent>
          <target>D</target>
          <isCampaignDefault>true</isCampaignDefault>
        </CampaignCreatives>
      </campaignCreatives>
      <category>
        <string>General-VIPME-4</string>
        <string>luohaihao&romeqaz</string>
      </category>
      <interval>-1</interval>
      <schedule>2023-02-06T12:11:21</schedule>
      <signature></signature>
      <campaignStatus>Waiting</campaignStatus>
    </createCampaign2>
  </soap12:Body>
</soap12:Envelope>