How to send mail from jsp

hi,
i want to send mail from my jsp page.
1) how can i do this
2) do i need any mail server for doin this
thanks
regards
manoj

i want to send mail from my jsp page.
1) how can i do this
2) do i need any mail server for doin thisRead
http://java.sun.com/developer/onlineTraining/JavaMail/
Rather,
try this:
http://jakarta.apache.org/taglibs/doc/mailer-doc/mailer-1.1/index.html

Similar Messages

  • How to send mail from jsp pageq

    Pls help me with this topic
    Thanks alot

    Can you make it clearer. Pls give me a sample code if possible
    Thanks alot

  • 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.

  • How to send Mail in JSP

    Hi,
    I am newbee in Java, I want to send mail to different accounts using java from my website. Plz help me with working example. I am new to java.
    Thanks in advance,
    devom

    Thanks, but I want to send mail from my WEb page that is in JSP. The arcticle pointed out sends mail in core java. I already know how to send in Core java, but i want to send through JSP. Plz help me.
    Thanks in advance,
    Devom

  • How to send mail from servlets

    m having troubles sending mail from servlets...
    how do you use the SimpleMailUser object needed in the session?
    a sample code on this would be of great help, thanks!

    <html>
    <body bgcolor="white">
    <font size=5 color="black">
    <%@ page import="javax.servlet.http.HttpUtils" %>
    <%@ page import="java.util.*" %>
    <%@ page import = "java.sql.*" %>
    <%@ page import = "java.io.*" %>
    <%@ page import= "sun.net.smtp.SmtpClient" %>
    <%
         String from,to,subject,msgbody,serverName;
         try
    from = request.getParameterValues("from")[0];
    to = request.getParameterValues("to")[0];
    subject = request.getParameterValues("subject")[0];
    msgbody = request.getParameterValues("msgbody")[0];
    serverName = request.getParameterValues("server")[0];
         catch (Exception e)          // Generally Speaking, an Error getting one of these
                                       // Values means that it wasnt passed in; inform the user
              out.println("You must call this JSP from this ");
              out.println("<A href=\"FormMail.htm\"> form</A>.<BR>");
              out.flush();return;
    %>
    Hold On A Moment while I try to Send Your Mail... <BR>
    <%
         out.flush();
         // Here are the real guts of the mail sending
         try
         sun.net.smtp.SmtpClient sm = new sun.net.smtp.SmtpClient(serverName);
         sm.from(from);
         sm.to(to);
         PrintStream msg = sm.startMessage();
         msg.println("To: ");     // Note dont use + for Performance
         msg.println(to);
         msg.println("Subject: ");
         msg.println(subject);
         msg.println();
         msg.println(msgbody);
         msg.println("==============");
         msg.print("This mail brought to you by JSP MAIL..from a user at IP ");
         msg.println(request.getRemoteHost());
         sm.closeServer();
         out.println("Your Mail Has Been Sent!");
         catch (Exception e)
              out.println("The mail couldn't be sent, probably because the mailhost wasnt set correctly.<BR> ");
              out.println("The error message I am getting is: ");
              out.println(e.getMessage());
    %>
    <BR>
    <BR>
    Click here to send another!

  • Sending Mail from JSP-Servlet

    hi all,
    Can any one help me, how can i send the mail from JSP-Servlet.
    in Spring, we have a the following package to send mail,
    import org.springframework.mail.MailSender;
    import org.springframework.mail.SimpleMailMessage;
    import org.springframework.mail.javamail.JavaMailSenderImpl;
    Suggest me to solve the problem.
    Thanx in advance.
    Bala

    Hi balu,
    i already go thru that API. My problem is if i add any additional jar file for sending the mail from JSP or Servlets only. not in high technology.
    i mention spring as an example.
    so, kindly suggets me on that.
    Bala

  • How to send mail using jsp program

    am very new to jsp and doing my final year project. i need to send mails using my jsp program.can anyone say wht to do that is wht to include to send mails using jsp program. n also a sample code to send mail using jsp program.
    Thanx in advance

    Use below script.
    <%@ page import="java.util.*, javax.mail.*, javax.mail.internet.*" %>
    <%
    Properties props = new Properties();
    props.put("mail.smtp.host", "mailserver.com");
    Session s = Session.getInstance(props,null);
    InternetAddress from = new InternetAddress("[email protected]");
    InternetAddress to = new InternetAddress([email protected]");
    MimeMessage message = new MimeMessage(s);
    message.setFrom(from);
    message.addRecipient(Message.RecipientType.TO, to);
    message.setSubject("Your subject");
    message.setText("Your text");
    Transport.send(message);
    %>{code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Sending Mail from jsp

    Hi guys,
    can anyone help me out of this problem ??
    I have written a piece of code which sends mail from a jsp page.
    When I use the 'Recipient'(TO) as an address in the same domain
    (ie,<xxx>@<apeejaygroup.com>) it works fine.
    But when I use an address such as <xxx>@<rediffmail.com>
    the code gives an error like -
    "javax.mail.SendFailedException: Sending failed;
    nested exception is:
    javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
    javax.mail.SendFailedException: 550 5.7.1 ... Relaying denied"
    I am sending the piece of code for reference..
    String host ="192.168.33.11";
    String from="[email protected]";
    String to="<xxx>@apeejaygroup.com";
    ( HERE USING THE ADDRESS AS <xxx>@<rediffmail>.com
    GIVES THE EXCEPTION - javax.mail.SendFailedException: 550 5.7.1 ... Relaying denied )
    Properties props = System.getProperties();
    props.put("mail.smtp.host", host);
    javax.mail.Session session1 = javax.mail.Session.getDefaultInstance
    (props, null);
    MimeMessage message = new MimeMessage(session1);
    message.setFrom(new InternetAddress(from));
    message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));
    message.setSubject("Your Registration Details");
    message.setContent(body,"text/html");
    Transport.send(message);
    Please help me out of this.
    Regards
    Satrajit

    as you said that it might require authentication
    but our mail server doesn't require authentication to mail.
    Now what should i do ??Many servers are now authenticating by requiring you to fetch your e-mail before sending. This is basically because most SMTP mail servers CAN NOT authenticate in the normal sense of the word. So, they use the fetch process for authentication. The fetch process already requires authentication normally. Then your IP address will be good for, say, 20 minutes, and you can relay e-mail through the server.
    It works with most E-mail clients such as Outlook or Netscape, because the default behavior is to 1.Connect to the POP server, 2.Login, 3.Download any new mail, 4.Connect to the SMTP server, 5.Upload any mail to send.
    Even if you don't have any mail, your IP address will at least have been authenticated. Even if you just check for mail, and not download any, you should be OK.
    So what I'd suggest is that you write some code that attempts to connect to your mail system's POP server, get authenticated successfully, then try sending out the e-mail through the SMTP server.

  • How to send mails from Oracle database

    Hi All,
    I want to send a mail from my oracle database once my store
    procedure runs successfully or fails.
    How can i do this.
    what are the preliminary modules of Oracle which need to be
    active for me to do so.
    If any once can also mention about any links that give
    information about the same it will be very helpful for me.
    Thanks and Regards
    Srinivas Chebolu

    CREATE OR REPLACE PROCEDURE SEND_MAIL_TCP(
    msg_from varchar2 := '[email protected]',
    msg_to varchar2,
    msg_subject varchar2 := 'E-Mail message from your database',
    msg_text varchar2 := '' )
    IS
    c utl_tcp.connection;
    rc integer;
    BEGIN
    c := utl_tcp.open_connection('1.17.0.218', 25); -- open the SMTP
    port 25 on local machine
    dbms_output.put_line(utl_tcp.get_line(c, TRUE));
    rc := utl_tcp.write_line(c, 'HELO localhost');
    dbms_output.put_line(utl_tcp.get_line(c, TRUE));
    rc := utl_tcp.write_line(c, 'MAIL FROM: '||msg_from);
    dbms_output.put_line(utl_tcp.get_line(c, TRUE));
    rc := utl_tcp.write_line(c, 'RCPT TO: '||msg_to);
    dbms_output.put_line(utl_tcp.get_line(c, TRUE));
    rc := utl_tcp.write_line(c, 'DATA'); -- Start message body
    dbms_output.put_line(utl_tcp.get_line(c, TRUE));
    rc := utl_tcp.write_line(c, 'Subject: '||msg_subject);
    rc := utl_tcp.write_line(c, '');
    rc := utl_tcp.write_line(c, msg_text);
    rc := utl_tcp.write_line(c, '.'); -- End of message body
    dbms_output.put_line(utl_tcp.get_line(c, TRUE));
    rc := utl_tcp.write_line(c, 'QUIT');
    dbms_output.put_line(utl_tcp.get_line(c, TRUE));
    utl_tcp.close_connection(c); -- Close the connection
    EXCEPTION
    when others then
    raise_application_error(-20000,'Unable to send e-mail message
    from pl/sql');
    END;
    show errors
    exec send_mail(msg_to =>'[email protected]');
    exec send_mail(msg_to
    =>[email protected]',msg_text=>'Look Yaar, I can send
    mail from plsql');

  • How to send SMS from JSP application.

    Hi,
    I have created a web application using JSP for our Office internal use. I want to include the folowing option in our app.
    1) How to send SMS from the application to mobile.
    2) I don't want to use third party service (ex: SimpleWire). as the app is for internal purpose only.
    It will be helpful, if I get the complete procedure to implement it, as this is my first application.
    Thanks & Regards
    suresh.

    I am having problem with smslib. smslib is an enhanced version of jsmengine, I have compiled the program, there is no error but when I run it , the following error is found. Can you help? my email is [email protected]
    Exception in thread "main" java.lang.NoClassDefFoundError: CIncomingMessage (wrong name: org/smslib/CIn
    comingMessage)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

  • Sending mail from JSP through Microsoft Outlook

    Hi all,
    i want to send an e-mail from JSP by clicking on link or button through Microsoft's Outlook..
    Can anyone guide me..

    something like this,
              try{
                   props = new Properties();
                   props.load(this.getClass().getClassLoader().getResourceAsStream("contact.properties"));
                   int i=0;
                   String referer = props.getProperty("contact.allow.referer."+i);
                   email = props.getProperty("report.email.error");
                   while(referer != null){
                        i++;
                        contact.put(referer, "true");
                        referer = props.getProperty("contact.allow.referer."+i);
              }catch(Exception e){
                   e.printStackTrace();
              try{
                   Session session = (Session)new InitialContext().lookup(this.props.getProperty("reports.jndi.email"));
                   SMTPMessage m = new SMTPMessage(session);
                   m.setFrom(InternetAddress.parse(this.props.getProperty("report.email.from"))[0]);
                   m.setRecipient(RecipientType.TO, new InternetAddress(this.email));
                   m.setSubject(this.getSub());
                   StringBuffer msg = new StringBuffer();
                   msg.append("Employee Name: "+fn + " " + ln +"\n");
                   msg.append("Employee ID: "+this.getId()+"\n");
                   msg.append("Message: "+this.getMsg()+"\n");
                   m.setText(msg.toString());
                   m.setReplyTo(InternetAddress.parse("no-reply"));
                   m.saveChanges();
                   Transport trans = session.getTransport();
                   trans.send(m);
                   trans.close();
              }catch(Exception e){
                   e.printStackTrace();
              }          contact.properties:
    reports.jndi.email=java:comp/env/globalMail
    report.generation.timeout=3000
    report.email.subject=Some Subject
    [email protected]
    [email protected]

  • How to send sms from jsp

    how to send sms from jsp

    First of all, you need to have the gsm modem or access to any Telco sms gateway.
    If you don have any access to the Telco sms gateway, try to download the SMSLib-Java-v2.1.2 java library from the http://sourceforge.net/project/showfiles.php?group_id=164313.
    Edit the example in the download file and include the example in your JSP file to send the sms using GSM modem.

  • How to send mail from a query

    Hi,
    I met a problem, it was about send mail from a query.
    Scenario: FirstĀ  make an exception in one query , and if the query trigger the exception , it can send a mail.

    Hi Tino,
    If you are in 7.0, you can use Broadcasting by Exception:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/81/0799413985ad5fe10000000a1550b0/frameset.htm

  • How can Send Email From JSP to all Mail server.it gives error

    I try this code in netbean 5.But it will give the Error.
    The code:
    <%@page import="java.util.*"%>
    <%@page import="javax.mail.*"%>
    <%@page import="javax.mail.internet.*"%>
    <%
    Properties props = System.getProperties();
    props.put("mail.smtp.host", "smtp.gmail.com" );
    props.put("mail.smtp.port", "465" );
    Session s = Session.getInstance(props, null);
    MimeMessage message = new MimeMessage(s);
    String From = request.getParameter("sender");
    InternetAddress from = new InternetAddress(From);
    message.setFrom(from);
    String Tos = request.getParameter("reciever");
    InternetAddress to = new InternetAddress(Tos);
    message.addRecipient(Message.RecipientType.TO, to);
    String sub =request.getParameter("subject");
    message.setSubject(sub);
    String mgs =request.getParameter("message");
    message.setText(mgs);
    Transport.send(message);
    %>
    <html>
    <p align="center">
    A Message has been sent. <br>
    Check your inbox.
    </p>
    <p align="center">
    Click here to send another!
    </p>
    </html>
    Error is :
    javax.servlet.ServletException: Could not connect to SMTP host: smtp.gmail.com, port: 465
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
         org.apache.jsp.MailBeema_jsp._jspService(MailBeema_jsp.java:88)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
    root cause
    javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
    nested exception is:
         java.net.ConnectException: Connection timed out: connect
         com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282)
         com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
         javax.mail.Service.connect(Service.java:275)
         javax.mail.Service.connect(Service.java:156)
         javax.mail.Service.connect(Service.java:105)
         javax.mail.Transport.send0(Transport.java:168)
         javax.mail.Transport.send(Transport.java:98)
         org.apache.jsp.MailBeema_jsp._jspService(MailBeema_jsp.java:68)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)

    javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
    nested exception is:
    java.net.ConnectException: Connection timed out: connectFairly self-explaining, isn't it? That host cannot be connected.
    Either check the correctness of the hostname/port, or check your network settings (firewall, router, etc).

  • How to send info from JSP page as email-body

    Hi,
    i have a JSP page that generates dynamically as a result of some query. I have a Button - "Send Email".
    I want to send the information to the receipient thru email automatically on a button click,
    All information is in the memory. How can we pick the info from memory and send it as a message thru email?
    Pls help.
    thanx & regards,
    Shalini

    create a servlet to send mail (use the JavaMail api) then Post the message to the servlet when you click on the button.
    OR, put the message and any other data (like the email address) into the session, and then just call the servlet on click of the button, and have the servlet retrieve the information from the session.

Maybe you are looking for

  • Reg : Archiving of Internal Order

    Hai Friends I am working on Archiving of Control Orders(Internal Orders) using KO02. Archiving can be done only when deletion flag is set for Internal Order. My issue is I want to set deletion flag for the Internal Order without going into the TCode

  • SWF and FLV file  sizes

    Hello, I have an flv file and the same flv file in an swf file. Both files are the same size. So, it seems that it doesn't matter, whether you import an flv file or an swf file, to keep your file size small. Is this correct ? Thanks, Paul

  • HT201210 The Iphone  " I Phone" could not be resortored an unknown error occurred  ( -1)

    A recovered version of this content exists from Jan 14, 2013 11:06 AM. Would you like to use the recovered version or delete it?

  • How to bock syslog CCH323-3-CALL_SETUP_FAILED

    Is there a way or will there be a solution on how to block a specific messages before sending it to a syslog server. So far, they can be blocked by severity groups. For example, i would like to block the the following level 3 message: %CCH323-3-CALL_

  • Which Mini for Aperture?

    I am looking to purchase a Mini, and could use some guidance on which model to choose. Aside from the typical usage, I rely on Aperture, InDesign, and Photoshop. Not much in the way of gaming or video production. Does the discrete GPU have a signific