allenzzzxd
allenzzzxd

Reputation: 331

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

Upvotes: 1

Views: 2821

Answers (3)

pajcon
pajcon

Reputation: 11

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

Upvotes: 1

kbrimington
kbrimington

Reputation: 25682

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.

Upvotes: 3

OneSHOT
OneSHOT

Reputation: 6953

Looks like your mail server or spam service have removed your attachement and replaced it with the txt file, it sounds like your code is fine and you need to speak to an admin regarding the mail filters and send size quotas!

Upvotes: 1

Related Questions