Skip Navigation Links.
展开 最小化

SpreadWebServcie.SendTemplateAttachments Method

Send template email with multiple attachments.

Note: The contact will be automatically added to the contact list named "Auto_ + Current Date".This function allows duplicate sending, so the contact list may contains duplicate email.Do not use this contact list in other campaigns, if you want to avoid duplicate sending.

public String SendTemplateAttachments (

string LoginEmail,

string APIKey,

string To,

string TemplateId,

string Subject,

string SubstitutionVars,

string CreativeLanguage

CampaignAttachment() files

)

Public function SendTemplateAttachments( _

LoginEmail As String, _

APIKey As String, _

To As string, _

TemplateId As String, _

Subject As String, _

SubstitutionVars As String, _

CreativeLanguage As Byte(), _

files As CampaignAttachment()_

) As String

No sample for PHP.
No sample.

Parameters

Parameter

Type

Description

LoginEmail

String

The login email of your Spread account.

APIKey

String

The password of your Spread account API Key which you can retrieve from your Spread account (My account=> Settings).

To

String

The email address of recipient.

TemplateId

String

TemplateId. It is CampaignID.

Subject

String

The subject of the campaign.

SubstitutionVars

String

It is a custom value of Json type, such as : If there is a tag named [CUSTOM] in campaign, then you can send : {"[CUSTOM]":"Value"} .

CreativeLanguage

String

language, such as : en,en-us,zh-tw,zh-cn.

fils

CampaignAttachment()

attachment files.

Return Value

String Represent the result of send status ."Sent success" means success,others fail

Example

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);

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

Dim APIKey As String = "spread"

 

  'Define recipient email

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

 

  'Define recipient email

Dim TemplateId As String = "1"

Dim Subject As String = "Title"

 

 'Content Information

Dim SubstitutionVars As String = "{""[CUSTOM]"":""Value""}"

 

 'Language Information

Dim CreativeLanguage As String = "en"

 

 'Attachment Information

Dim files As SpreadWebService. CampaignAttachment()

ReDim files(2)

 

files(0) = New SpreadWebService. CampaignAttachment

files(0).displayName = "cat.png"

files(0).file = File .ReadAllBytes( "xxxx/cat.png" )

files(0).fileType = ".png"

 

files(1) = New SpreadWebService. CampaignAttachment

files(1).displayName = "dog.png"

files(1).file = File .ReadAllBytes( "xxxx/dog.png" )

files(1).fileType = ".png"

 

'Create a SpreadWebService object and use its method.

Dim MySpread As New SpreadWebService

Dim Result As String = MySpread.SendTemplateAttachments(LoginEmail,APIKey,ToEmail,TemplateId, Subject,SubstitutionVars,CreativeLanguage,files)

        /**
     * @name     sendOne
     * @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 sendOne($loginEmail,$APIKey,$toEmail,$templateId,$subject,$substitutionVars,$creativeLanguage,$files){
        $sendParam = array(
            'LoginEmail'    => $loginEmail,
            'APIKey'      => $APIKey,
            '[To]'  => $toEmail,
            'TemplateId'          => $templateId,
            'Subject'          => $subject,
            'SubstitutionVars'      => $substitutionVars,
            'CreativeLanguage'            => $creativeLanguage,
            'files'          => $files
        );
        $Client=new SoapClient("http://service.rspread.com/Service.asmx?WSDL");
        error_log( json_encode( $sendParam )."__param" );
        $sendResult = $Client -> SendTemplateAttachments( $sendParam ); 
        return $sendResult;
    }
         
No sample.