This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes How to send an Excel file as an attachment using java. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "How to send an Excel file as an attachment using java." Watch "How to send an Excel file as an attachment using java." New topic
Author

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

Anu satya
Ranch Hand

Joined: Mar 17, 2005
Posts: 146
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?


With Regards,
Anu
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41155
    
  45
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.


Ping & DNS - my free Android networking tools app
Anu satya
Ranch Hand

Joined: Mar 17, 2005
Posts: 146
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
Marshal

Joined: Mar 22, 2005
Posts: 41155
    
  45
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.
 
 
subject: How to send an Excel file as an attachment using java.
 
Similar Threads
Excel by email using struts framework
Create .csv from .xls
How to view XLS documents loaded from database
How to send email with no attachment?
XLS File download from server