use 

javax.mail.internet.MimeBodyPart
javax.mail.internet.MimeMessage
javax.mail.internet.MimeMultipart

- use one MimeBodyPart to hold the email text, and one to hold the
attachment (don't forget the content-type)
- use a MimeMultipart to hold your MimeBodyParts
- set the content of your MimeMessage to the MimeMultipart

We use this method with a FOP generated PDF (in memory, never written to
disk).

--
Voytek Jarnot
"Racing makes heroin addiction look like a vague longing for something
salty." - Peter Egan 



> -----Original Message-----
> From: CRANFORD, CHRIS [mailto:[EMAIL PROTECTED]
> Sent: Thursday, September 02, 2004 7:25 AM
> To: 'Struts Users Mailing List'
> Subject: RE: PDF & Email
> 
> 
> What I'm trying to get at is a way to generate the PDF in memory and
> attachment it that way from memory without actually having to 
> use a physical
> disk file.  Basically we have a form that gathers information about a
> request.  That form in turn is converted to the message's 
> body content but
> we also want to render a PDF attachment that is an approval 
> form that can be
> printed by the recipient, signed and then filled.  I'd like 
> to do all this
> without any physical disk I/O files.  Possible?
> 
> -----Original Message-----
> From: Matthias Wessendorf [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, September 02, 2004 8:25 AM
> To: 'Struts Users Mailing List'
> Subject: RE: PDF & Email
> 
> 
> or like this:
> 
> 
> 
> // Create the attachment
> EmailAttachment attachment = new EmailAttachment();
> attachment.setPath("mypictures/john.jpg");
> attachment.setDisposition(EmailAttachment.ATTACHMENT);
> attachment.setDescription("Picture of John"); 
> attachment.setName("John");
> 
> // Create the email message
> MultiPartEmail email = new MultiPartEmail();
> email.setHostName("mail.myserver.com");
> email.addTo("[EMAIL PROTECTED]", "John Doe");
> email.setFrom("[EMAIL PROTECTED]", "Me"); email.setSubject("The picture");
> email.setMsg("Here is the picture you wanted");
> 
> // add the attachment
> email.attach(attachment);
> 
> // send the email
> email.send();
> 
> 
> 
> 
> 
> 
> 
> 
> > -----Original Message-----
> > From: Matthias Wessendorf [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, September 02, 2004 2:21 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: PDF & Email
> > 
> > 
> > you only use setter-methods
> > for clazz Email / simpleEmail
> > and so one...
> > 
> > see:
> > 
> > SimpleEmail email = new SimpleEmail(); 
> > email.setHostName("mail.myserver.com");
> > email.addTo("[EMAIL PROTECTED]", "John Doe");
> > email.setFrom("[EMAIL PROTECTED]", "Me"); email.setSubject("Test 
> > message"); email.setMsg("This is a simple test of commons-email");
> > email.send();
> > 
> > 
> > no painfull
> > 
> > Storage and so on ... :-)
> > 
> > it is easy... more than easy
> > 
> > 
> > Regards,
> > Matthias
> > 
> > > -----Original Message-----
> > > From: HG [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, September 02, 2004 2:26 PM
> > > To: Struts Users Mailing List
> > > Subject: Re: PDF & Email
> > > 
> > > 
> > > Hi Chris
> > > 
> > > Can't recall from my memroy how to do it, and I don't 
> have access to 
> > > the source from my current location, sorry.
> > > 
> > > No one says, you should use JavaMail as is.
> > > The mail library referred to by Matthias seems to be 
> great...and as 
> > > far as I can see it uses the Java Mail API also....but greatly 
> > > simplifies the act of doing E-mails...The Java Mail API 
> can be very 
> > > cumbersome....
> > > 
> > > HTH
> > > 
> > > Henrik
> > > 
> > > ----- Original Message -----
> > > From: "CRANFORD, CHRIS" <[EMAIL PROTECTED]>
> > > To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> > > Sent: Thursday, September 02, 2004 2:09 PM
> > > Subject: RE: PDF & Email
> > > 
> > > 
> > > > Have any code snippets you could share on how to pass the
> > generated
> > > > PDF to javamail as an attachment.  That would greatly 
> expedite my
> > > > coding
> > > efforts...
> > > >
> > > >
> > > > TIA
> > > > Chris
> > > >
> > > > -----Original Message-----
> > > > From: HG [mailto:[EMAIL PROTECTED]
> > > > Sent: Thursday, September 02, 2004 8:14 AM
> > > > To: Struts Users Mailing List
> > > > Subject: Re: PDF & Email
> > > >
> > > >
> > > > Hi Chris
> > > >
> > > > I used iText (http://www.lowagie.com/iText/) in the past to
> > > generate
> > > > the
> > > PDF
> > > > and then JavaMail API to send it as an attachment. Works great..
> > > >
> > > > Regards
> > > >
> > > > Henrik
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: "CRANFORD, CHRIS" <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Thursday, September 02, 2004 1:59 PM
> > > > Subject: PDF & Email
> > > >
> > > >
> > > > > I need to generate an email along with a PDF within a
> > java struts
> > > > > action
> > > > and
> > > > > send that email with the PDF attachment using java mail.
> > > Can anyone
> > > > > recommend a great PDF package that I can do this and
> > > render the PDF
> > > > > as an email attachment in realtime?
> > > > >
> > > > > _______________________________________________________
> > > > > Chris Cranford
> > > > > Programmer/Developer
> > > > > SETECH Inc. & Companies
> > > > > 6302 Fairview Rd, Suite 201
> > > > > Charlotte, NC  28210
> > > > > Phone: (704) 362-9423, Fax: (704) 362-9409, Mobile:
> > (704) 650-1042
> > > > > Email: [EMAIL PROTECTED]
> > > > >
> > > > >
> > > >
> > > >
> > > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > 
> > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to