Hi,

you may use the standard javax.mail apis to send mail with attachments.
like

Message body = new MimeMessage( mailSession );
<...... code to set subject from and to ..........>
Multipart multipart = new MimeMultipart();
<in  a loop for multiple files>
       BodyPart messageBodyPart = new MimeBodyPart();
       String fileName = <the file to be attached (full path)>
       DataSource source =  new FileDataSource(fileName);
       messageBodyPart.setDataHandler(new DataHandler(source));
       
messageBodyPart.setFileName(fileName.substring(fileName.lastIndexOf(separator)+1));
       multipart.addBodyPart(messageBodyPart);
<file attachement loop ends>

body.setContent( multipart );
Transport.send( body );

Hope this helps.

jeyaraj

>From: "Tran, Thanh" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: JRun-Talk <[EMAIL PROTECTED]>
>Subject: sending mail with attachments
>Date: Thu, 11 Jul 2002 16:57:07 -0700
>
>Hi,
>
>My server is running JRun 3.1.  I have been using jrun taglib to send mail
>out from a jsp script.
>Recently, I need to also include attachments with each email I sent out.  I
>don't remember
>seeing an attachment attribute within jrun sendmail taglib.  Has anyone 
>been
>able to do so or is there a different way to do this?
>
>
>thanks in advance,
>Thanh
>
______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to