Link to home
Start Free TrialLog in
Avatar of SRM19
SRM19

asked on

Attaching files to email in .net application.

hello,

i need to look in a folder and if there are any files in the folder I need to attach all the files to an email in the .net application. can I please know how to check if any files exists in the folder and if exists then attach them to the email.

any help in this regard is appreciated.

Thanks,
SRM.
Avatar of josgood
josgood
Flag of United States of America image

System.IO.Directory exposes static methods for creating, moving, and enumerating through directories and subdirectories
http://msdn.microsoft.com/en-us/library/system.io.directory.aspx

This link shows how to add attachments to a MailMessage
http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.attachments.aspx

You can send a MailMessage with the SmtpClient class
http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.send.aspx
ASKER CERTIFIED SOLUTION
Avatar of motocross_geek
motocross_geek

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SRM19
SRM19

ASKER

hello motocross geek,

that was real kind of you to send the code. i will try this later but I am sure it will work. thanks a lot.