struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jarnot Voytek Contr AU/SC <Voytek.Jar...@MAXWELL.AF.MIL>
Subject RE: PDF & Email
Date Thu, 02 Sep 2004 12:42:26 GMT
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:chris.cranford@setechusa.com]
> 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:mailings@matthias-wessendorf.de] 
> 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("jdoe@somewhere.org", "John Doe");
> email.setFrom("me@apache.org", "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:mailings@matthias-wessendorf.de]
> > 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("jdoe@somewhere.org", "John Doe");
> > email.setFrom("me@apache.org", "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:struts@nospam.websolver.dk]
> > > 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" <chris.cranford@setechusa.com>
> > > To: "'Struts Users Mailing List'" <user@struts.apache.org>
> > > 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:struts@nospam.websolver.dk]
> > > > 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" <chris.cranford@setechusa.com>
> > > > To: <user@struts.apache.org>
> > > > 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: chris.cranford@setechusa.com
> > > > >
> > > > >
> > > >
> > > >
> > > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > > For additional commands, e-mail: user-help@struts.apache.org
> > > >
> > > >
> > > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > > For additional commands, e-mail: user-help@struts.apache.org
> > > >
> > > 
> > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message