in file attachmets i used class file like this
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Sunday, January 18, 2004 10:00 PM

public void addAttachment(String[] args) throws javax.mail.MessagingException { String directory = args[0]; BodyPart messageBodyPart = new MimeBodyPart(); messageBodyPart.setText("Directory: " + directory); Multipart multipart = new MimeMultipart(); multipart.addBodyPart(messageBodyPart); File dir = new File(directory); String list[] = dir.list(); for (int i=0, n=list.length; i File f = new File(directory+list[i]); if (f.isFile()) { System.out.println("Adding: " + list[i]); messageBodyPart = new MimeBodyPart(); DataSource source = new FileDataSource(directory+list[i]); messageBodyPart.setDataHandler(new Data   More>>

public void addAttachment(String[] args) throws javax.mail.MessagingException
{
String directory = args[0];
BodyPart messageBodyPart = new MimeBodyPart();

messageBodyPart.setText("Directory: " + directory);

Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);

File dir = new File(directory);
String list[] = dir.list();

for (int i=0, n=list.length; i
File f = new File(directory+list[i]);
if (f.isFile()) {
System.out.println("Adding: " + list[i]);
messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource(directory+list[i]);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(list[i]);
multipart.addBodyPart(messageBodyPart);
}

message.setContent(multipart);
}
and i used class file like this
String args[]=new String[1];
args[0]="D:/CompassServer/webapps/compass/Material";
Mailer mail = new Mailer();
mail.setSession();
mail.addAttachment(args);
here i am getting attachment as path
D:/CompassServer/webapps/compass/Material like this but i am not getting all files in meterial folde,can anybody give solution

   <<Less

Re: in file attachmets i used class file like this

Posted By:   Anonymous  
Posted On:   Tuesday, January 20, 2004 03:59 AM

hey
i got result for this can anybody want regarding attachment i will help.
About | Sitemap | Contact