Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 97039 invoked from network); 3 Oct 2006 18:23:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 3 Oct 2006 18:23:17 -0000 Received: (qmail 53378 invoked by uid 500); 3 Oct 2006 18:23:15 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 53130 invoked by uid 500); 3 Oct 2006 18:23:15 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 53119 invoked by uid 99); 3 Oct 2006 18:23:14 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Oct 2006 11:23:14 -0700 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests= Received: from [81.228.9.181] ([81.228.9.181:41548] helo=av7-1-sn3.vrr.skanova.net) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id 6B/C7-08153-F8AA2254 for ; Tue, 03 Oct 2006 11:23:13 -0700 Received: by av7-1-sn3.vrr.skanova.net (Postfix, from userid 502) id DF5EE37F2E; Tue, 3 Oct 2006 20:22:57 +0200 (CEST) Received: from smtp3-2-sn3.vrr.skanova.net (smtp3-2-sn3.vrr.skanova.net [81.228.9.102]) by av7-1-sn3.vrr.skanova.net (Postfix) with ESMTP id CF5EB37ECE for ; Tue, 3 Oct 2006 20:22:57 +0200 (CEST) Received: from [192.168.2.210] (h221n3-m-sp-gr100.ias.bredband.telia.com [81.236.186.221]) by smtp3-2-sn3.vrr.skanova.net (Postfix) with ESMTP id AC17637E43 for ; Tue, 3 Oct 2006 20:23:05 +0200 (CEST) Message-ID: <4522AA88.1030509@pmb.mine.nu> Date: Tue, 03 Oct 2006 20:23:04 +0200 From: Peter Petersson User-Agent: Thunderbird 1.5.0.5 (X11/20060728) MIME-Version: 1.0 To: user@geronimo.apache.org Subject: Re: File attatchement in geronimo mail References: <45228B75.9010503@pmb.mine.nu> <4522A266.3080207@gmail.com> In-Reply-To: <4522A266.3080207@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Rick McGuire wrote: > Peter Petersson wrote: >> Im using Geronimo 1.1.1 and has just started to look into geronimo-mail. >> Is it posible to send a multipart mail with a file atatchement in the >> current imp. of geronimo-mail ? >> In the case of yes any (code) examples out there explaining how to >> get it done ? > Here's a simple example (essentially the same code axis uses to send a > mime-encoded attachment): > Thanks Rick I just noticed the geronimo-activation spec :) It whas the part I whas missing. Peter > MimeMessage message = new MimeMessage(session); > message.setFrom(new InternetAddress("someone@somewhere.com")); > message.setRecipients(Message.RecipientType.TO, > InternetAddress.parse("someone.else@somewhere.com")); > message.setSubject("test subject"); > message.setText("test message"); > BodyPart messageBodyPart1 = new MimeBodyPart(); > messageBodyPart1.setText("part 1"); > BodyPart messageBodyPart2 = new MimeBodyPart(); > messageBodyPart1.setHeader("Content-Type", "text/plain"); > messageBodyPart1.setHeader("Content-Transfer-Encoding", "binary"); > messageBodyPart2.setHeader("Content-Type", "text/plain"); > messageBodyPart2.setHeader("Content-Transfer-Encoding", "binary"); > DataSource dataSource = new FileDataSource("xx.dat"); > messageBodyPart2.setDataHandler(new DataHandler(dataSource)); > messageBodyPart2.setFileName("xx.dat"); > Multipart multipart = new MimeMultipart(); > multipart.addBodyPart(messageBodyPart1); > multipart.addBodyPart(messageBodyPart2); > message.setContent(multipart); > > >> >> Cheers >> Peter >> >