Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

C# zipping files and emailing

Posted on 2005-04-15
6
Medium Priority
?
442 Views
Last Modified: 2012-05-05
Hi,
I have a folder which has say 10 files, I want to zip these 10 files together into one single zip file and email to a given email address as an attachment. I am using C# for this application. Please give me some suggestions as to how it can be done using C#.
Thanks
0
Comment
Question by:sunilramu
3 Comments
 
LVL 3

Accepted Solution

by:
mpf1748 earned 672 total points
ID: 13794814
For zipping, Component One, www.componentone.com has a commercial Zip feature. Another one that I've used, which is GPL, is SharpZipLib. You can find it at http://www.icsharpcode.net/OpenSource/SharpZipLib/Default.aspx.
0
 
LVL 8

Assisted Solution

by:rajaloysious
rajaloysious earned 664 total points
ID: 13797399

http://www.yoda.arachsys.com/csharp/faq/#zip
>>Does .NET have any compressiong/zipping capabilities?
The .NET framework doesn't contain any general purpose compression libraries, but there are plenty of third-party libraries available. The most commonly referenced is probably SharpZipLib, which is free and open source but may still be used in commercial applications.
http://www.icsharpcode.net/OpenSource/SharpZipLib/Default.aspx


cheers
0
 
LVL 14

Assisted Solution

by:existenz2
existenz2 earned 664 total points
ID: 13797757
To zip the files you can use the given suggestions above. You can e-mail it the following way:

using System.Web.Mail;
...
MailMessage mail = new MailMessage();
mail.To = "me@mycompany.com";
mail.From = "you@yourcompany.com";
mail.Subject = "this is a test email.";
mail.Body = "this is my test email body.";
MailAttachment attachment = new MailAttachment( "test.txt" );
mail.Attachments.Add( attachment );
SmtpMail.SmtpServer = "localhost";
SmtpMail.Send( mail );

Note: System.Web.Mail is a part from ASP.NET, so you need that installed also.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Loops Section Overview
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question