...
// creo l'opzionecreating "note" option
it.mailupnet.services.Option optNote = new it.mailupnet.services.Option();
optNote.Key = "note";
optNote.Value = "Queste sono le note";
// allegoattaching una file alto the messaggiomessage
// 1. LeggoReading ilthe messaggiomessage ed effettuo l'encoding inand content base 64 del contenutoencoding
FileStream fs = new FileStream(@"C:\mydir\webservice.docx",
FileMode.Open, FileAccess.Read);
byte[] filebytes = new byte[fs.Length];
fs.Read(filebytes, 0, Convert.ToInt32(fs.Length));
string encodedData = Convert.ToBase64String(filebytes,
Base64FormattingOptions.InsertLineBreaks);
// 2. Creao l'opzione Creating "attach01_name" cheoption conterrĂ containing ilthe nome delfilename
file
it.mailupnet.services.Option optAttach01Name =
new it.mailupnet.services.Option();
optAttach01Name.Key = "attach01_name";
optAttach01Name.Value = "test.docx";
// 3. Creao l'opzione Creating "attach01_data" cheoption conterrĂ containing ilthe contenutofile delcontent
file
it.mailupnet.services.Option optAttach01Data =
new it.mailupnet.services.Option();
optAttach01Data.Key = "attach01_data";
optAttach01Data.Value = encodedData;
// creating creothe l'array delleof opzionisending dioptions
invio
it.mailupnet.services.Option[] options = new it.mailupnet.services.Option[3];
options[0] = optNote;
options[1] = optAttach01Name;
options[2] = optAttach01Data;
string html = "codice HTML del messaggio";
string s = myService.CreateNewsletter(accessKey,
1, "WebService // Newsletter da HTML", "HTML", html, options);
... if (errorCode == 0)
{
// eseguoexecuting return ilmessage parsing delto messaggioretrieve di ritorno per ricavare il codicethe code
// identificaticomessage delidentifier messaggio creatocreated
} |