Skip Navigation Links.
展开 最小化

SpreadWebServcie.SendWithAttachment Method

Send transactional 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 SendWithAttachment (

string LoginEmail,

string Password,

string CampaignName,

string From,

string FromName,

string To,

string replyTo,

string Subject,

string Body,

CampaignAttachment [] files

)

Public function send( _

LoginEmail As String, _

Password As String, _

CampaignName As string, _

From As string, _

FromName As String, _

To As String, _

replyTo As string, _

Subject As String, _

Body As String _

files () As CampaignAttachment _

) As String

No sample for PHP.
No sample.

Parameters

Parameter

Type

Description

LoginEmail

String

The login email of your Spread account.

Password

String

The password of your Spread accountAPI Keywhich you can retrieve from your Spread account (My account=> Settings).

CampaignName

String

The name of the email campaign.

From

String

The email address of sender.

FromName

String

The name of sender.

To

String

The email address of recipient.

replyTo

String

The reply email address

Subject

String

The subject of the campaign.

Body

String

The content of the campaign. Support plain text or HTML tag

files

CampaignAttachment[]

The attachments

Return Value

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

Example

string LoginEmail = "spread@reasonables.com";

string LoginPassword = "spread";

string CampaignName = DateTime .Now.ToString();

 

 //Define the from infomation

string From = "myedm@edm.com";

string FromName = "Reasonable";

 

//Define recipient email

string To = "noclone@reasonables.com"; 

string replyTo = "myedm@edm.com"; 

 

//Define the email subject and body

string Subject = "NoClone 4 is released!"; 

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

 

//Attachment infomation.

CampaignAttachment[] files = new CampaignAttachment [2];

files[0] = new CampaignAttachment ();

files[0].displayName = "1234.txt" ;

files[0].file = File .ReadAllBytes( "xxxx/1234.txt" );

files[0].fileType = ".txt" ;

files[1] = new CampaignAttachment ();

files[1].displayName = "cat.png" ;

files[1].file = File .ReadAllBytes( "xxxx/cat.png" );

files[1].fileType = ".png" ;

 

//Create a SpreadWebService object and use its method.

SpreadWebService MySpread = new SpreadWebService();

 

string result = MySpread.SendWithAttachment(LoginEmail,LoginPassword,CampaignName,

From,FromName,To,replyTo,Subject,Body,files);

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

Dim LoginPassword As String = "spread"

Dim CampaignName As String = Now.ToString()

 

  '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"

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

 

 'Define the email subject and body

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

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

 

'Attachment infomation.

Dim files() As CampaignAttachment

ReDim files(2)

files(0) = New CampaignAttachment

files(0).displayName = "1234.txt"

files(0).file = File .ReadAllBytes( "xxxx/1234.txt" )

files(0).fileType = ".txt"

files(1) = New CampaignAttachment

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

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

files(1).fileType = ".png"

 

'Create a SpreadWebService object and use its method.

Dim MySpread As New SpreadWebService

Dim Result As String=MySpread.SendWithAttachment(LoginEmail, LoginPassword,CampaignName, From,Fromname, [To],replyTo,Subject,Body,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 SendWithAttachment($loginEmail,$assword,$actName,$from,$fromName,$toEmail,$replyTo,$Msubject,$Mbody,$files){
        $sendParam = array(
            'LoginEmail'    => $loginEmail,
            'Password'      => $password,
            'CampaignName'  => empty( $actName ) ? SITE_DOMAIN.'_act_'.date( 'Y-n-j' ) : $actName,
            'From'          => $from,
            'FromName'      => $fromName,
            'To'            => $toEmail,
            'replyTo'       => $replyTo,
            'Subject'       => $Msubject,
            'Body'          => $Mbody,
            'files'         => $files
        );
        $Client=new SoapClient("http://service.rspread.com/Service.asmx?WSDL");
        error_log( json_encode( $sendParam )."__param" );
        $sendResult = $Client -> SendWithAttachment( $sendParam ); 
        return $sendResult;
    }
         
No sample.