...
// creocreating l'opzione "note" option
it.mailupnet.services.Option optNote = new it.mailupnet.services.Option();
optNote.Key = "note";
optNote.Value = "Queste sono le noteThis is a short message description";
// allegoattaching una file alto the messaggiomessage
// 1. LeggoReading ilthe messaggiomessage edand effettuo l'encoding in content base 64 delencoding
contenuto
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 nomefilename
del 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;
// creocreating the l'array delleof opzionisending di inviooptions
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 messaggiothis is message content (HTML body of message to be sent)";
string s = myService.CreateNewsletter(accessKey,
1, "WebService // Newsletter da HTML", "HTML", html, options);
...Â
if (errorCode == 0)
{
// eseguoEnter ilhere parsingif delmethod messaggiocall diis ritornosuccessful perand ricavarereceived ilresponse codicecan // identificatico del messaggio creatobe parsed
} |