Skip Navigation Links.
展开 最小化

SpreadWebServcie.Send2 Method

指定邮件活动的名称一对一的发送邮件.

注:联系人将自动加入“Auto_+邮件名“的联系人名单,此函数允许重复发送,所以对应名单可能会出现重复联系人.请勿在其他邮件使用该联系人名单,以防止邮件重复发送.

public String Send2 (

string LoginEmail,

string Password,

string CampaignName,

string From,

string FromName,

string To,

string Subject,

string Body

)

Public function Send2( _

LoginEmail As String, _

Password As String, _

CampaignName As String,_

From As string, _

FromName As String, _

To As String, _

Subject As String, _

Body As String _

) As String

No sample for PHP.
No sample.

参数

参数

类型

描述

LoginEmail

String

Spread账号的邮件地址

Password

String

Spread账号的密码或者 API Key.

CampaignName

String

被发送邮件的名称

From

String

发送者的邮件地址

FromName

String

发送者的名称.

To

String

收件者的邮箱地址.

Subject

String

邮件的主题.

Body

String

邮件内容. 纯文本或带html标签均可

返回结果

String  表示邮件的发送状态.

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

状态/场景

返回类型

返回信息

请求API成功,且发送成功。

String

Sent success

请求该API时”LoginEmail“或者”Password“为空。
String

LoginEmail or Password is null

请求该API时"FromName", "Subject "或者"Body"为空。 String

Information requried

请求该API时,"From"或者"To"不符合邮箱格式。 String

Invalid Email Address

请求该API时"LoginEmail"或者"Password"错误。 String

LoginEmail and Password do not match

请求该API时,账号过期,或者账号内没有发送量。 String

This user has expired or credit not enough

每个账号最多每天可以创建20个邮件活动。当您的账号今天已经创建了20个邮件活动之后再去请求创建新的,会返回该信息。 String

Creation exceeded the daily maximum number of campaign.

收件人为无效邮箱,无法进行发送。 String

Invalid Address and Failed to Sent.

其他错误情况 Exception

返回一个异常包含错误信息

处理完发送请求,但发送失败。 String

Sent failed

例子

string LoginName = "spread@reasonables.com";

string LoginPassword = "spread";

 

string CampaignName = "Noclone campaign";

 

 //Define the from infomation

string From = "myedm@edm.com";

string FromName = "Reasonable";

 

//Define recipient email

string To = "noclone@reasonables.com"; 

 

//Define the email subject and content

string Subject = "NoClone 4 is released!"; 

string Body = "Download NoClone 4 at http://noclone.net now!";  

 

//Create a SpreadWebService object and use its method.

SpreadWebService MySpread = new SpreadWebService();

 

string result = MySpread.send2(LoginName,LoginPassword,CampaignName,From,FromName,To,Subject,Body);

Dim LoginName As String = "spread@reasonables.com"

Dim LoginPassword As String = "spread"

 

Dim CampaignName As String = "Noclone campaign"

 

  'Define the from infomation

Dim From As String = "myedm@edm.com"

Dim FromName As String= "Reasonable"

 

 'Define recipient email

Dim To As String= "noclone@reasonables.com"

 

 'Define the email subject and content

Dim Subject As String= "NoClone 4 is released!"

Dim Body As String= "Download NoClone 4 at http://noclone.net now!"

 

'Create a SpreadWebService object and use its method.

Dim MySpread As New SpreadWebService

Dim Result As String= MySpread.send2(LoginName, LoginPassword,CampaignName, From,FromName, To,Subject,Body)

        /**
     * @name     send2
     * @function send email one by one
     * @return
     *   'Invalid Email Address'                                            
     *   'Information required'                                             
     *   'LoginEmail and Password do not match'                             
     *   'Sent failed'                                                      
     *   'Your email has submitted successfully and will by send out soon.' 
     *   'Sent success'                                                     
     */
    public function send2($loginEmail,$assword,$actName,$from,$fromName,$toEmail,$Msubject,$Mbody){
        $sendParam = array(
            'LoginEmail'    => $loginEmail,
            'Password'      => $password,
            'CampaignName'  => empty( $actName ) ? SITE_DOMAIN.'_act_'.date( 'Y-n-j' ) : $actName,
            'From'          => $from,
            'FromName'      => $fromName,
            'To'            => $toEmail,
            'Subject'       => $Msubject,
            'Body'          => $Mbody
        );
        $Client=new SoapClient("http://service.rspread.com/Service.asmx?WSDL");
        error_log( json_encode( $sendParam )."__param" );
        $sendResult = $Client -> Send2( $sendParam ); 
        return $sendResult;
    }
         
No sample.