View Post for Code Snippets and Other Examples



[ Reply to Post ] [ Back To Forum ]
From: "trotter" <trotter246 ( at ) gmail dot com>
Date: 9/13/2010 5:29:39 AM
Subject: attach all file from directory
Hi all please can you help?
I am trying to add all text files in a directory c:\source as an attachment to an email but i cant get it right :(


string [] files = Directory.GetFiles (@"c:\Source", "*.txt");
foreach (string file in files)

mail.Attachments.Add(new Attachment(files));


can anyone see where i am going wrong? please help this is driving me mad....

 

 

 



Thread View

Subject By Date
attach all file from directory [ you are here ] trotter 9/13/2010
   RE: attach all file from directory dave wanta 9/13/2010
     RE: attach all file from directory trotter 9/13/2010