• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to send an Excel file as an attachment using java.

 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all.
I am using jsp code to read a text file from Tomcat server and send a email with that text file as an attachment.

My problem:
I want to send .xls file as an attachment.
That is, save a file in server with .xls extension, and then add this file as an attachment in the e-mail.
Is it possbile using only java code?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is possible. Have a look at the POI library (from Jakarta) for creating Excel files. Sending emails from Java code is generally done using the JavaMail API; of course, you will need a mail server for this. If you don't have one, and want to stay in the Java space, have a look at Apache James.
 
Anu satya
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:
That is possible. Have a look at the POI library (from Jakarta) for creating Excel files. Sending emails from Java code is generally done using the JavaMail API; of course, you will need a mail server for this. If you don't have one, and want to stay in the Java space, have a look at Apache James.



Thank you Dittmer for your reply.

I do have a mail server. I am sending mail with following code.


SO, in this way (i.e without using JavaMail API, and POI is it possible to send .xls attachment?)
Can you provide me more information about Apache James please?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you already have an Excel file, you will not need the POI library, because that is used to create an Excel file.

What do you mean by "without using JavaMail API"? You are using JavaMail. Whether the code is correct I don't know; I have not used JavaMail to send attachments.

Innformation about James can be obtained at the James web site. But since you say that you have a mail server, you don't need it.
 
get schwifty. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic