简体   繁体   中英

How to send .zip in attachment by email on exchange server?

Hell guys,

I'm coding in csharp to send an email which contains a .zip file (has htmls and css inside). When I check the mail recieved, In fact, instead of the .zip file, the attachment becomes a txt file and has:

FILE QUARANTINED

The original contents of this file have been replaced with
this message because of its characteristics.
File name: 'xxxxxxx_Result.zip'
Virus name: 'Large uncompressed size'

The exchange server has blocked the zip file..I'm using CDO to create and send the email.

I tried using the code to send a mail with a zip file generated by WINZIP, there was no problem, then I tried using outlook to send a mail with the zip file generated by my code(I use sharpziplib library), the problem occured...

How can I do to send the attachment correctly? Many thanks in advance!

Allen

I encounter similar problems sending email on our network. I've found that using an alternate compression format, such as 7-zip (.7z), is adequate to get my content through the filters. This could resolve the issue if the block is not due strictly to size.

For anyone facing this problem, here is a solution. You have to explicitly set the file size for the zipentry.

ZipEntry newEntry = new ZipEntry(fileName);
newEntry.DateTime = DateTime.Now;
newEntry.Size = fileData.Length; // setting data size

看起来您的邮件服务器或垃圾邮件服务已删除您的附件并将其替换为txt文件,听起来您的代码很好,您需要与管理员讨论邮件过滤器和发送大小配额!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM