Page tree
Skip to end of metadata
Go to start of metadata

C# code for message creation

// creating "note" option optNote = new;
optNote.Key = "note";
optNote.Value = "This is a short message description"; 
// attaching a file to the message
// 1. Reading the message and content base 64 encoding
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. Creating "attach01_name" option containing the filename optAttach01Name = new;
optAttach01Name.Key = "attach01_name";
optAttach01Name.Value = "test.docx";
// 3. Creating "attach01_data" option containing the file content optAttach01Data = new;
optAttach01Data.Key = "attach01_data";
optAttach01Data.Value = encodedData; 
// creating the array of sending options[] options = new[3];
options[0] = optNote;
options[1] = optAttach01Name;
options[2] = optAttach01Data; 
string html = "this 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)
  // Enter here if method call is successful and received response can be parsed
  • No labels


  1. Anonymous

            Dim optNote As New ServiceReference1.Option()

            optNote.Key = "note"

            optNote.Value = "TEST"

            Dim options(0) As ServiceReference1.Option

            options(0) = optNote


            Dim s_returnc_code As String = mu_send.CreateNewsletter(New CreateNewsletterRequest(New CreateNewsletterRequestBody(s_accessKey, 1, "TEST SUBJECT", "TEXT", "this is message content (HTML body of message to be sent)", options))).Body.CreateNewsletterResult


    with this code i get always 230 error, somebody can tell me why ?


  2. Hello and thanks for reporting us this issue.

    Error 230 is a generic exception; please try to edit reference to our WS endpoint and set it as "Web reference" in place of  "Service Reference".

    Please let us know if that solves your problem. In case it doesn't, I'd suggest to log a ticket with our support dept.