How to send email through jsp

can anyone please help me ...
how do we send an email from a jsp page to any gmail,hotmail,yahoomail etc....
what is the code for that
if anybody know the solution it will be greatly appreciated ..
regards
santhosh
9341208148

I have a writeup that shows how to use JavaMail. It presents my EmailDelivery class (and example of how to use it) which I wrote to help me easily send emails from my Java applications using JavaMail. It supports relaying through SMTP servers that require authentication and has convenience methods for easily adding file attachments.
Check it out at:
http://timarcher.com/?q=node/53

Similar Messages

  • How to send emails using JSP?

    How can i send emails using JSP? what are the things that i will need? please help me asap...thanks

    Hi,
    This works for me:
    <%
    String from = "Person"
    String to= "my-email-address;
    try{
    SmtpClient client = new SmtpClient("smtp.stuff.com");
    client.from(from);
    client.to(to);
    PrintStream message = client.startMessage();
    message.println("To: " + to);
    message.println("Subject: Sending an e-mail");
    message.println();
    message.println("Groovy :-)");
    client.closeServer();
    catch (IOException e){
    System.out.println("ERROR SENDING EMAIL: "+e);
    %>

  • How to send EMAIL through SmartForms

    Hi,
    Anyone plz help me how to send mails through smartforms.
    I want to send mails through smartforms.
    Plz suggest me regarding the same.
    Thanks & Regards,
    Sumivasu

    Hi Sumi,
    Same method as normal program, use the function SO_OBJECT_SEND.
    I'm sure you have tips about that in this forums.
    Regards
    Frédéric

  • [b]How to Send Email Through Developer using Micrsoft Outlook[/b]

    Here is the Code to Send Email From Developer 2000 using Microsoft Outlook(Note :- Outlook should be configured)
    Steps:-
    1. First Add the Wrapper Procedures for Outlook Express from the OLE Importer Utility such as
    · OUTLOOK_ATTACHMENT
    · OUTLOOK_MAILITEM
    PROCEDURE SENDEMAIL(to_Person varchar2,subject varchar2,body varchar2) IS
    EmailApp ole2.obj_type;
    EmailItem Ole2.Obj _Type;
    EmailAttachment Ole2.Obj_Type;
    EmailAttach ole2. obj_Type;
    aa number(5):=1;
    begin
    EmailApp:=ole2.create_obj('outlook.application');
    EmailItem:=ole2. create_obj('outlook.mail item');
    EmailAttachment:=ole2.create_obj('outlook.Attachment');
    EmailItem:=Outlook_Application.create Item(Email App,Outlook_Constants.olmailitem);
    EmailAttach:=Outlook_Mail Item.Attachment(Email Item);
    Add attachment From Block
    Go_block('BLK_ATTACHMENT');
    FIRST_RECORD;
    LOOP
    Email Attachment:=OutLook_Attachment.ole_Add(EmailAttach,;BLK_ATTACHMENTS.attach,1,AA,ISPNAME);
    AA:=AA+1;EXIT WHEN:SYSTEM.LAST_RECORD='TRUE';
    NEXT_RECORD;
    END LOOP;
    Outlook_mailitem.OLE_to(EmailItem,TO_PERSON);
    Outlook_mailitem.subject(emailitem,SUBJECT);
    Outlook_mailitem.Ole_body(emailitem,MAIL.BODY);
    Outlook_mailitem.send(emailItem);
    End;

    Here is the Code to Send Email From Developer 2000 using Microsoft Outlook(Note :- Outlook should be configured)
    Steps:-
    1. First Add the Wrapper Procedures for Outlook Express from the OLE Importer Utility such as
    · OUTLOOK_ATTACHMENT
    · OUTLOOK_MAILITEM
    PROCEDURE SENDEMAIL(to_Person varchar2,subject varchar2,body varchar2) IS
    EmailApp ole2.obj_type;
    EmailItem Ole2.Obj _Type;
    EmailAttachment Ole2.Obj_Type;
    EmailAttach ole2. obj_Type;
    aa number(5):=1;
    begin
    EmailApp:=ole2.create_obj('outlook.application');
    EmailItem:=ole2. create_obj('outlook.mail item');
    EmailAttachment:=ole2.create_obj('outlook.Attachment');
    EmailItem:=Outlook_Application.create Item(Email App,Outlook_Constants.olmailitem);
    EmailAttach:=Outlook_Mail Item.Attachment(Email Item);
    Add attachment From Block
    Go_block('BLK_ATTACHMENT');
    FIRST_RECORD;
    LOOP
    Email Attachment:=OutLook_Attachment.ole_Add(EmailAttach,;BLK_ATTACHMENTS.attach,1,AA,ISPNAME);
    AA:=AA+1;EXIT WHEN:SYSTEM.LAST_RECORD='TRUE';
    NEXT_RECORD;
    END LOOP;
    Outlook_mailitem.OLE_to(EmailItem,TO_PERSON);
    Outlook_mailitem.subject(emailitem,SUBJECT);
    Outlook_mailitem.Ole_body(emailitem,MAIL.BODY);
    Outlook_mailitem.send(emailItem);
    End;

  • 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 email through oracle bpm suite 10.3.2?

    I need to send an email to a particular participant each time the instance change activities.
    I have created the "External Resource - Outgoing Mail" but to use the code below, I had no success ...
    do
              Mail.from = "[email protected]";
              Mail.recipient = "[email protected]"
              Mail.subject = "Hi";
              Mail.contentType= "Content-type: text/plain;";
              Mail.message = "Hello";
              send Mail;
         on e as Exception
              display "Error!";
    I use the Oracle BPM Suite 10.3.2
    Grateful.
    Wellington.

    Using your logic you'd need to set the SMTP field for the Engine.
    Since you configured the Outgoing Email External Resource, you might try this instead:
    mail as Mail
    mail.from = "[email protected]"
    mail.recipient = "[email protected]"
    mail.subject = "Hi"
    mail.message = "Hello"
    mailSender as MailSender = Fuego.Net.MailSender(mail : mail)
    send(mailSender, implname : "{name of Mail Outgoing Service}")Dan

  • Sending email through outlook

    Hi,
    i got a email functionality requirement , i need to send the report output to recipient inbox as an attachment, through outlook.
    i know how to send email from sap, but through outlook i am not aware,
    how to send email through outlook.
    can any one please help me.
    Thanks In Advance
    raagati

    Hi,
       check below link.
    How to send email from outlook to SAP inbox

  • About how to send ALV through email

    Hi  everyone ,
          I have a problem about how to send ALV through email  in background . if someone knows , pls tell me .
    thanks in advance
    Best Regard
    Nick

    I write a test program , but it doesn't work , use any exists ALV program in the system , and use the "sendlist " program to send the email.  what I want is when I restrict some conditons in the selection-screen , then it send ALV to Email .
    Thanks
    Nick

  • Sending an email through JSP and WML

    I am trying to send an email through jsp in wml, i think i have everything set up properly with regards to tomcat however I keep getting the error
    "Invalid element 'PCDATA' in context of card expected on event ....."
    The line of code in which this occurs is           
    <jsp:setProperty name="mailer" property="*"/>
    I was wondering if anyone would be able to help me with this and be able to tell me why it thinks this is PCDATA and not jsp code.
    Any help would be much appreciated.

    Check out:
    http://jakarta.apache.org/taglibs/index.html

  • How to set attched file name while sending email through ABAP

    Hi All- tell me how to set attched file name while sending email through ABAP.
    regards...
    Abhay

    Sure,  when you are adding your entry to the packing list,  give the name in the obj_name field.
    *File 2
      mailbin = 'This is file 2'.
      append mailbin.
      data: start type i.
      data: end type i.
      start = tab_lines + 1.
      describe table mailbin lines end.
      mailpack-transf_bin = 'X'.
      mailpack-head_start = 1.
      mailpack-head_num = 1.
      mailpack-body_start = start.
      mailpack-body_num = end.
      mailpack-doc_type = 'TXT'.
      mailpack-obj_name = 'TEST2'.        "<-  RIGHT HERE
      mailpack-obj_descr = 'Subject'.
      mailpack-doc_size = tab_lines * 255.
      append mailpack.
    Regards,
    RIch Heilman

  • 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);
         }

  • Send email through Yahoo mail or Gmail with Java

    I have a java email program that can take a mail host name , port number and then send an email, but I don't want to use the mail host at work, I wonder if I can send email through my Yahoo Mail or Gmail account with Java, do they have any Java API that my program can log me in and send emails ? Any sample code available ? Thanks.
    Frank

    Thanks for reminding me, I did some search on "Yahoo" and "Gmail". For Yahoo someone posted some code that didn't work, for gmail, there seems to be a solution for sending email from command line. I wonder if I can send full fledged email : with CC, BCC, Attachment, Html email with images inside ...
    I've done it with a local mail host, but how to do it with Yahoo or Gmail ?
    Frank
    Have you read the JavaMail FAQ? Search for "Yahoo" and "Gmail".

  • Send email through applet

    Hello!
    Can anyone give me simple code of applet where i can send email through the form... and jar files or anything i have to import...
    Thank you very much

    Depends on how you want to handle it.
    If you want to send an email from the User's email program, you can execute a simple http request to "mailto:[email protected]" from within the applet by calling
    Applet.getAppletContext().showDocument("mailto:[email protected]")This will cause an email window to pop up using the user's email client.
    However, if you want to send email from within your program directly then you get into an area that is a little more complicated.
    First you would be using the javax.mail API. http://java.sun.com/products/javamail
    The problem you would have with this is that as an Applet you can only connect back to the server from which you came. So that server MUST have an SMTP process running on it. Otherwise you cannot send mail out since an Applet is not allowed to contact any other server other than it's own.
    If that security restriction is not a problem, then the example code at http://developer.java.sun.com/developer/onlineTraining/JavaMail/ should do everything you need.

  • How to send emails from HANA SQL Console

    Hi,
    Please guide how  to send mail from HANA Studio SQL Console.
    Is there any standard procedure in Hana Studio to send Mail( e.g. in MS SQL  "sp_send_dbmail" Procedure)

    Hi Preethi,
    Please go through the attached link:
    How to send emails from HANA
    Regards,
    Krishna

  • How to send email via PL/SQL

    Hi guys,
    I have already read several topics about that subject. However, I haven't understood well. It is very complicated. Could somebody explain step by step or show a detail source about sending email through pl/sql?
    Thanks alot.

    876928 wrote:
    I have tried it, but I get this error.
    ora-29278 smtp transient error 421 service not available
    By the way I use gmail, I don't know how I change my settings? I mean Ain't I suppose to type my mails pass and username ?
    gmail won't forward your SPAM.
    you need to utilize local Mail Transport Agent that is explicitly configured to relay messages from DB Server

Maybe you are looking for