SpreadWebServcie.SendWithAttachment Method

 

一对一的发送邮件.并可携带多个附件

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

public String SendWithAttachment (

string LoginEmail,

string Password,

string CampaignName,

string From,

string FromName,

string To,

string replyTo,

string Subject,

string Body,

CampaignAttachment [] files

)

参数

参数

类型

描述

LoginEmail

String

Spread账号的登录邮箱.

Password

String

Spread账号的密码或者API Key.

CampaignName

String

活动名称.

From

String

发送者的邮箱地址.

FromName

String

发送者的名称.

To

String

收件者的邮箱地址.

replyTo

String

回复邮件的地址.

Subject

String

邮件的主题.

Body

String

邮件的内容.

files

CampaignAttachment[]

附件.

返回结果

String  表示邮件发送的结果. ."Sent success" 表示成功,其他表示失败

例子

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

参见

SpreadWebService Class | Spread Web Service Namespace

CampaignAttachment Class