Sending file from jsp

Dear Friends,
I copied all the jar files (mail.jar, activation.jar, smtp.jar..etc.,) to jakarta's lib directory.
But when i run sendmail.jsp program, exception is raising.
=======================================
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile C:\jakarta-tomcat-3.3a\work\DEFAULT\examples\jsp\sendmail_1.java:8: Package javax.mail not found in import.
import javax.mail.*;
^
C:\jakarta-tomcat-3.3a\work\DEFAULT\examples\jsp\sendmail_1.java:9: Package javax.mail.internet not found in import.
import javax.mail.internet.*;
^
C:\jakarta-tomcat-3.3a\work\DEFAULT\examples\jsp\sendmail_1.java:10: Package javax.activation not found in import.
import javax.activation.*;
^
3 errors
=======================================
I already set the classpath for these. and i am able to run on command prompt.
please help me. if you have any ideas, please share ur ideas.
Once again thank you very much for your kind cooperation.
Yours
Rajesh
Looking for your reply.
My Program
<%@page import="java.io.*"%>
<%@page import="java.util.*"%>
<%@page import="javax.mail.*"%>
<%@page import="javax.mail.internet.*"%>
<%@page import="javax.activation.*"%>
<%
String to = request.getParameterValues("[email protected]")[0];
String from = request.getParameterValues("[email protected]")[0];
String host = request.getParameterValues("your.smtp.net")[0];
String filename = request.getParameterValues("c:/Button.html")[0];
String msgText1 = "Sending a file.\n";
String subject = "Sending a file";
// create some properties and get the default Session
Properties props = System.getProperties();
props.put("mail.smtp.host", host);
Session session = Session.getDefaultInstance(props, null);
session.setDebug(debug);
try {
// create a message
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(subject);
// create and fill the first message part
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText(msgText1);
// create the second message part
MimeBodyPart mbp2 = new MimeBodyPart();
// attach the file to the message
FileDataSource fds = new FileDataSource(filename);
mbp2.setDataHandler(new DataHandler(fds));
mbp2.setFileName(fds.getName());
// create the Multipart and its parts to it
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp1);
mp.addBodyPart(mbp2);
// add the Multipart to the message
msg.setContent(mp);
// set the Date: header
msg.setSentDate(new Date());
// send the message
Transport.send(msg);
} catch (MessagingException mex) {
mex.printStackTrace();
Exception ex = null;
if ((ex = mex.getNextException()) != null) {
ex.printStackTrace();
%>

Dear Friend,
Thank you very much for you reply.
My Tomcat.bat file is like this
C:\>cd jakar*.*
C:\jakarta-tomcat-3.3a>set TOMCAT_HOME=c:\jakarta_tomcat-3.3a
C:\jakarta-tomcat-3.3a>set java_home=c:/jdk1.3.1
C:\jakarta-tomcat-3.3a>set path=c:/jdk1.3.1\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System
32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;c:\jdk1.3.1\bin\;.;
C:\jakarta-tomcat-3.3a>set TOMCAT_HOME=c:\jakarta-tomcat-3.3a
C:\jakarta-tomcat-3.3a>set classpath=D:\jaf-1.0.1\activation.jar;.;D:\javamail-1.2\mail.ja
r;.;c:\jdk1.3.1\lib\tools.jar;.;D:\jaf-1.0.1\activation.jar;D:\javamail-1.2\mail.jar;D:\javamail-1.2\smtp.jar;D:\javamail-1.2\pop3.jar;D:\javamail-1.2\mailapi.jar;
C:\jakarta-tomcat-3.3a>bin\startup
Starting Tomcat in new window
C:\jakarta-tomcat-3.3a>
=========================
But still it is saying (when i am trying to run the sendmail.jsp) Internal Server Error : 500
org.apache.jasper.JasperException: Unable to compile C:\jakarta-tomcat-3.3a\work\DEFAULT\ROOT\sendmail_1.java:6: Package javax.mail not found in import.
import javax.mail.*;
^
C:\jakarta-tomcat-3.3a\work\DEFAULT\ROOT\sendmail_1.java:7: Package javax.mail.internet not found in import.
import javax.mail.internet.*;
^
C:\jakarta-tomcat-3.3a\work\DEFAULT\ROOT\sendmail_1.java:8: Package javax.activation not found in import.
import javax.activation.*;
^
=====================
please help me.
Thanks in advance.
yours
Rajesh.

Similar Messages

  • Need to Send Mail from JSP...

    Dear Team,
    I Need to Send Mail from JSP, have Designed user Interface to enter
    to, from, subject, and message text .
    Have Downloaded mail.jar and activate.jar file..... and placed in tomcat lib directory and WEBAPPS/WEB-INF/lib Directory too
    How do i send a mail to user ?
    do I require something else apart from things that i have mentioned?
    do i have to Configure SMTP, POP3 or Something like this....
    Now If I Create a object of Type MimeMessage and Set Recipient, from, subject and if i say transport.send(message) will this do My JOB???

    Dear Team,
    I Need to Send Mail from JSP, have Designed user
    Interface to enter
    to, from, subject, and message text .
    Have Downloaded mail.jar and activate.jar file.....
    and placed in tomcat lib directory and
    d WEBAPPS/WEB-INF/lib Directory too
    How do i send a mail to user ?
    do I require something else apart from things that i
    have mentioned?
    do i have to Configure SMTP, POP3 or Something like
    this....
    Now If I Create a object of Type MimeMessage and Set
    Recipient, from, subject and if i say
    transport.send(message) will this do My JOB???Yup! in addition to all the above i need to know my mail box outgoing mail server. and that's enough...... i am able to do that.
    Regards,
    Jagadeesh HS.

  • Forwarding to an xml file from jsp page

    hi
    i am subhash. i have problem in forwarding an xml file from jsp page.
    i have a jsp page in which i have a button. upon click, its form method is triggered and the action is set to "serverpage.jsp". In that jsp page i have to move to an xml file. I would like u to send a sample code also for the same.
    Thank You,
    Subhash..

    Refer to the Generating XML from JSP section.
    http://java.sun.com/developer/technicalArticles/xml/WebAppDev2/

  • Cannot send files from phone to Satellite L755-16z using BT

    Hi, experts :)
    I'm gonna get straight to the point !
    I've got a toshiba satallite L755-16z since a month or so (New, with windows 7 64-bit)
    and its is known that it has BT and I guess its 3.0
    So I tried to connect the bluetooth with my phone & it paired just fine !
    but when I try to send files from and to my phone, it says (connecting) but doesn't manage to send it in the end. furthermore, this problem isn't only with my phone as I've tried sending and recieving to & from another phone, but still same problem !
    HOWEVER, I tried to turn the BT adapter off (right click on bluetooth Icon in notification area then turn adapter off), then starting the (bluetooth monitor) application, and sending files & IT WORKS !!
    But this happens only for one time right after restarting bluetooth, so everytime I have to send files, I have to turn BT off then turn it on ?!!!
    This is kind of Unacceptable !
    I tried Toshiba Bluetooth Stack, and it had the same problem. Also, I didn't like the way it worked (style and everything) ... so I uninstalled it & returned to the original BT version in pc.
    I've searched for answers with no luck & now I'm desperate for the answer !
    Plz anyone who knows how to solve this issue, help me Plz ??!
    If my email is needed : [[email protected]]

    ok I tried to turn it off with fn + f8 ... wlan turns off with it too, that's natural, I know :)
    then I turned it on & I recieved a file from phone just fine ... that only worked ONE time !
    after that, sending/recieving files won't work ... on my phone it says ( cannot connect ) .... same thing when I restart bt monitor manually !!
    Also, I have tried going to ( C:\Program Files (x86)\TOSHIBA\Bluetooth Monitor ) folder
    there are other bt monitors like (btmon2) and (btmon64) but both of them are have same problem but has more time of activity !
    the problem itself isn't that its on or off ...
    it is on and it appears in the notification area ... but only works for only a short period of time ...
    or for (btmon2) I can say it works right after starting it ... then works for a while when its active (sending files or recieving files) ... but after a while with no activity (no sending/recieving) It Stops Working :(
    How can I fix the problem ???
    Mr. Tonny ? Anyone ??

  • How do I send files from iPad to Mac book pro

    Hi I am having trouble blue too thing my new IPad Air to my mac book pro?

    Gillmweighill wrote:
    Hi I am having trouble blue too thing my new IPad Air to my mac book pro?
    That's be use you can't send files from the iPad to the Mac over Bluetooth without a third party app. This feature is not native in iOS.
    You can email files, use DropBox or another cloud sync service, or use iOS File Sharing with iTunes. - if the app that you are using supports file sharing. There are also apps that let you mount your iPad like a thumb drive that will allow you to move files back and forth by connecting the device to the USB a port with the provided cable or by using WiFi as well.
    it helps if you state what files you want to move, what app you are using, etc....details, details....

  • I want to send email from jsp,

    i want to send email from jsp, i dont know smtp:host, how to send mail?
    plz carify this doubt sir.

    OK thanks sir but i installed alredy. i write this code. plz send any error's are there. and i dont know smtp:host name. i put my port address?
    try{
        //Set the host smtp address
        Properties props = new Properties();
        props.put("mail.smtp.host", "//10/0/6/252");
        // create some properties and get the default Session
        Session session = Session.getDefaultInstance(props, null);
         // create a message
        Message msg = new MimeMessage(session);
        // set the from and to address
        msg.setFrom(new InternetAddress("[email protected]"));
         msg.addRecipient(Message.RecipientType.To,new InternetAddress("[email protected]"));
        // Setting the Subject and Content Type
        msg.setSubject("hi..");
        msg.setText("hi bharath how are you");
        Transport.send(msg);
    catch(Exception e)
                  out.println(e);
         }

  • How to call java class file from jsp

    hi
    we need to call java classes (which are written separately in .java file )from jsp file. we need it for our project if anyone knows about please reply us.
    bye
    siva sankari

    you can call the methods in a lot of ways. you could use scriptlets with the
    <%@ page import="package.class"%> and then inside instantiate an object
    <%
         MyClass mc = new MyClass(parameters if any);
         mc.theMethodYouWantToCall();
    %>or as Madathil has stated,
    or use the JSP tags
    <jsp:useBean id="anyname" class="classname"/>and then use the getProperty tag
    or even Custom Tags

  • Can't send files from my smartphone to my MacBook Air but can send from my MacBookAir to my smartphone ! WHY ??

    Hello,
    Bluetooth error:
    I have a problem to send files TO my MacBookAir through bluetooth but no pbm to send files FROM my MacBookAir. The bluetooth message is a failure in the connection ("no adresse IP"). How can I solve this ?
    Thks

    Ok now !!!! Thanks a lot, i really don't know why it was off, but your response is the solution. I did'nt know why i could send but not receive but no matter, now it's fine! GOOD !!!

  • I cant successfully send files from pages via email on my ipad

    The files i send from pages via mail hardly ever send, and when they do i am unable to open the file in the mail, i am having the same truble with sending files from the photo library from my i pad

    Try a Reset [Hold the Home and Sleep/Wake buttons down together for 10 seconds or so (until the Apple logo appears) and then release

  • Want a step by step scenario for sending file from PCK to XI to other sys.

    Hi all
    Want a step by step scenario for sending file from PCK to XI to other system
    i just want to check the flow of messages from PCK to XI by doing file to file scenario.
    Thanks

    Hi-
    Check this links
    http://help.sap.com/saphelp_nw04/helpdata/en/32/92e5bced6cb441af4360cfcb8142f3/frameset.htm
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/4256 [original link is broken] [original link is broken] [original link is broken] [original link is broken]

  • Sending files from MDM

    Hi All,
    Is it possible to send files from MDM using syndication/API's. When i say files i mean that if we have arecord in MDM which has a image/pdf stored with it and we want to send this record along with the jpg/pdf to external system-ECC. Can we handle this in MDM

    Hi Manish,
    As per my understanding this is not possible to Syndicate images. You can do it only through MDM Data Manager.
    Please find more threads with similar requirement:
    Is it possible to export images, pdf?
    export records with images - how to export the filename of the image?
    Syndicate /Export Images automatically..
    Syndication of images & PDF's
    Regards,
    Mandeep Saini

  • Can't send files from/to MBP Mavericks/ipad

    Hi,
    I am unable to send files from my mac book pro 10.9 to the ipad4 & vice versa.  They are connected on bluetooth but when I press send I get the message "this devise does not have the necessary services".
    thanks
    HH

    hubh wrote:
    How disappointing though to read that there is no compatibility for bluetooth.  Had I been made aware of this I certainly would not have bought the ipad.  I find it extremely disappointing that there's no publicity about this fact.  I feel utterly conned by Apple.
    Yes, there is compatibility for BT: headphones, keyboards, speakers, and other peripherals. And, yes, this is very well known. I'm not sure what you expected in the way of "publicity". No manufacturer lists all of the things their product doesn't do.
    Best of luck.

  • Help me send files from my Mac to my BlackBerry

    Friends:
    I'm trying to send files to my BlackBerry via BlueTooth with no luck. I attempt to initiate receiving the files from my BlackBerry prior to sending it from my Mac, but I get the following error:
    "File Transfer Connection Failed" (the file doesn't even begin to transfer)
    Oddly enough I can send files from the BlackBerry via BlueTooth easily.
    Sharing via BlueTooth is enabled on the Mac.
    In manage connections, the the BlueTooth is ON but it has a little dash next
    to the checkbox, not a green check mark like Wi-Fi and the Mobile Network do.
    Thanks for your ideas!
    Migs

    http://discussions.apple.com/forum.jspa?forumID=1003
    http://www.howardforums.com/
    I've found the easiest way on leopard(or panther & Tiger) is to use my ISP's web mail, and bear in mind I am using an LG phone and Verizon, to sent a message and attachment to my phone by To: [email protected] and then it comes to cell phone. I don't know if your carrier has such a # to send data like verizon does. Probably does. Depending on what machine and OS X I'm using, it all seems to work different. There are modem scripts in /Library/Modem\ Scripts for usage. But then Leopard Syspref seems to have a different style to setup those modems. Bluetooth is about like a chain saw. Tough, at best to start, sometimes.

  • How do I send files from my IMAC via bluetooth to my ne Ipad.  They will not "pair" but they are connected and discoverable.  I send a file from Imac snow leopard OS X 10.6 to the ipad but the failure message says the ipad does not have the ncessary servr

    How do I send files from my IMAC via bluetooth to my new Ipad?  They will not "pair" but they are connected and discoverable.  I send a file from Imac snow leopard OS X 10.6 to the ipadusing bluetooth,  but the failure message says the ipad does not have the necessary services.  What are these?  Do I neeed to have iphoto and ms word to send pix and .doc files?

    File Sharing over Bluetooth is not a feature of iOS devices. iOS does not include the required Bluetooth profiles to allow this. You cannot add this feature, so you may as well stop trying.

  • How can I send files from my macbook pro to my iPad air using airdrop

    how can I send files from my macbook pro to my iPad air using airdrop?

    Your going to have to find some alternative.  See Dukto will work.
    "Dukto is a simple application that allows you to share files between devices connected to the same (wireless) LAN network."
    http://www.tidal.it/?page_id=309&lang=en
    http://www.msec.it/blog/?page_id=11
    "Box lets you store all of your content online, so you can access, manage and share it from anywhere. Integrate Box with Google Apps and Salesforce and access Box on mobile devices" Rated the most secure cloud storage by SkyHigh Networks.  You can buy a license to run box one of your servers.
    https://www.box.com/
    Files Connect -- "Cloud Storage services like Dropbox, MobileMe iDisk, Google Docs/Picasa, Facebook photos, FTP, SFTP, WebDAV ... AFS (Apple File Shares) SMB (Windows shares)  protocols"
    https://itunes.apple.com/us/app/files-connect/id404324302?mt=8
    "The kiteworks mobile file sharing solution provides secure creation, viewing, and sharing of enterprise content on smartphones and tablets while providing IT and security teams the administrative controls to manage user privileges and access rights necessary to ensure enterprise security and compliance."  " Includes choice of private cloud on-premise."
    http://www.accellion.com/solutions/mobile-enablement/mobile-file-sharing

Maybe you are looking for

  • Trying to get gnome-main-menu-svn (SLAB) installed from AUR

    Having soem troubles installing gnome-main-menu-svn (SLAB) installed from the AUR using yaourt. After getting all the dependencies figured out, there still seems to be problems. Here is what I have so far: $ yaourt -S gnome-main-menu-svn ==> Resuming

  • C++ Compilers for Beginners

    Okay.  So, let me just start by saying that I do not wish to download Xcode at this time, because it is MASSIVE and mostly superfluous for my limited needs...which are to learn the basics of writing programs in C++.  Also, for whatever reason, it app

  • Mass change in component Scrap % in BOM

    Hi Guru, Can someone explain me the process of mass change in component scrap % in BOM ? I have to make zero coponent scrap % in BOM for all materials.

  • Can't upload photo

    I can't upload my photo to FB after i using v3.2. When i click "photo" is doesn't working? Please help me solve this problem... Solved! Go to Solution.

  • PSE 4 not opening?

    I have PSE4.0 for Mac, and starting about four months ago it would load until the box said "Reading preferences" and then would proceed to unexpectedly shut down. I just uninstalled and reinstalled, although upon reinstallation it did not ask for my