title: Converting byte array into downloadable outlook mail item in c#
body: <p>We have used Microsoft azure for our upload and download file functionality. We are able to successfully upload and download files, the issue is with mail items. We are able to upload and download .msg file, when we try to open it, its giving the error &quot;we can't open the item&quot;. The code is not breaking anywhere so its difficult to find the issue. Any help would be really helpful.</p>
  <p>converting the byte array to mail item</p>
  <pre><code>if (data != null) //this is the data from azure 
  {
    HttpResponse response = HttpContext.Current.Response;
    Response.Buffer = true;
    Response.ClearContent();
    Response.ClearHeaders();
    Response.ContentType = &quot;application/octet-stream&quot;;
    Response.AddHeader(&quot;Content-Disposition&quot;, &quot;attachment;filename=&quot; + filename);
    Response.AddHeader(&quot;Content-Length&quot;, data.Length.ToString());
    Response.BinaryWrite(data);
    Response.Flush();
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/tDUuE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tDUuE.png" alt="enter image description here" /></a></p>