[
  {
    "Id": "212493",
    "ThreadId": "62605",
    "Html": "<p>Hi,</p>\r\n<p>I'm new with the dotnetzip, it has been very easy and helpful. But I've encountered a problem and I'm not sure if it's related to the dotnetzip, to net.mail or I'm missing something.</p>\r\n<p>The thing is I email a weekly report in an Excel sheet, for security reasons now it has to be encrypted and protected with a password.</p>\r\n<p>This is how I do it:</p>\r\n<p>&nbsp;</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre>    <span style=\"color:Blue\">Dim</span> objZIP <span style=\"color:Blue\">As</span> ZipFile = <span style=\"color:Blue\">New</span> ZipFile()<br>    <span style=\"color:Blue\">Dim</span> ms <span style=\"color:Blue\">As</span> MemoryStream = <span style=\"color:Blue\">New</span> MemoryStream<br>    objZIP.Password = <span style=\"color:#A31515\">&quot;PASSWORD!&quot;</span><br>    objZIP.Encryption = EncryptionAlgorithm.WinZipAes256<br>    objZIP.AddEntry(<span style=\"color:#A31515\">&quot;newfile.xls&quot;</span>, <span style=\"color:#A31515\">&quot;&quot;</span>, strXLSReport)<br>    objZIP.Save(ms)<br>    ms.Seek(0, SeekOrigin.Begin)<br>   <span style=\"color:Green\">' ...</span>\r\n    <span style=\"color:Blue\">Dim</span> emailMessage <span style=\"color:Blue\">As</span> System.Net.Mail.MailMessage = <span style=\"color:Blue\">New</span> System.Net.Mail.MailMessage<br>   <span style=\"color:Green\">' ...</span>\r\n    <span style=\"color:Blue\">Dim</span> ExcelZip <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">New</span> System.Net.Mail.Attachment(ms, <span style=\"color:#A31515\">&quot;attachZip.zip&quot;</span>, Net.Mime.MediaTypeNames.Application.Zip)<br>    emailMessage.Attachments.Add(ExcelZip)<br>    objSMTPServer.Send(emailMessage)<br></pre>\r\n</div>\r\n<p>The email that I receive when executing this doesn't contain anything, and when I say anything I don't only mean the attachment, also recipient, subject, sender and body dissapear.</p>\r\n<p>If I remove the password assignment, it works perfect. I receive the email with all data and the attachment.</p>\r\n<p>I've also tried to save the protected zip to a folder (this worked perfect) and then attach and email it (in this case, the result was the same as using memorystream).</p>\r\n<p>I've made other tests such as changing encryption or the type of the zipped file, but all had the same ending.</p>\r\n<p>Any help or tips will be appreciated, thanks in advance!</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-07-16T03:27:20.07-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "212721",
    "ThreadId": "62605",
    "Html": "<p>You might try employing a Using clause or two.&nbsp; The streams often do not close properly when you do not surround them in Using.</p>\r\n<pre>    Dim ms As MemoryStream = New MemoryStream\r\n    Using objZIP As ZipFile = New ZipFile()\r\n      objZIP.Password = &quot;PASSWORD!&quot;\r\n      objZIP.Encryption = EncryptionAlgorithm.WinZipAes256\r\n      objZIP.AddEntry(&quot;newfile.xls&quot;, &quot;&quot;, strXLSReport)\r\n      objZIP.Save(ms)\r\n    End Using\r\n\r\n    ms.Seek(0, SeekOrigin.Begin)   ' ...\r\n\r\n    Dim emailMessage As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage   ' ...\r\n\r\n    Dim ExcelZip As New System.Net.Mail.Attachment(ms, &quot;attachZip.zip&quot;, Net.Mime.MediaTypeNames.Application.Zip)\r\n    emailMessage.Attachments.Add(ExcelZip)\r\n    objSMTPServer.Send(emailMessage)\r\n\r\n</pre>\r\n<p>have you looked at the result of the System.Mail.SmtpClient.Send ? I think there is a status code in there.</p>",
    "PostedDate": "2009-07-16T12:19:08.533-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "213736",
    "ThreadId": "62605",
    "Html": "<p>Hi, the problem has been solved.</p>\r\n<p>I had to change the SMTP Server due to environment requirements, and this seemed to be the main problem, it will need further investigation, but that's on my side.</p>\r\n<p>With the different server the email is received correctly with password and encryption and everything.</p>\r\n<p>Thanks for your the help and quick reply</p>",
    "PostedDate": "2009-07-20T02:55:08.45-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "213895",
    "ThreadId": "62605",
    "Html": "<p>glad to hear it.</p>",
    "PostedDate": "2009-07-20T10:28:16.193-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]