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);
%>

Similar Messages

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

  • How to send emails using java code

    Hi,
    can any give me some sample code for sending emails using java language

    JavaMail quick start
    jGuru: Fundamentals of the JavaMail API

  • 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

  • How to send emails using Automatic Work Items in Collections using XML Publ

    Hi,
    We are using XML Publisher to send correspondances in Advanced Collections.
    We want to send email correspondances using Automatic Strategy Work Items.
    Can anybody please help on how to send these?

    I believe you have to define your dunning template and assign that template to the strategy work item.
    Let me know if you are still not able to do it.
    Thanks,
    Anil

  • How to send email using pl/sql containing the result set as the msg body

    Hi.. im using Pl/SQL code to send emails to the users from a dataset that is obtained in a databse table. i have used utl_smtp commands to establish the connection with the smtp mail server. im stuck at the logic when i have to include the message body which is actually the result set of a table.. For instance
    IF (p_message = 0) THEN
    UTL_SMTP.write_data(l_mail_conn, 'There is no mismatch between the codes' || UTL_TCP.crlf);
    ELSE
    UTL_SMTP.write_data(l_mail_conn, 'The missing codes are ' || UTL_TCP.crlf);
    for s in (select * from temp)
    loop
    UTL_SMTP.write_data(l_mail_conn, ' ' ||s || UTL_TCP.crlf);
    end loop;
    END IF;
    UTL_SMTP.close_data(l_mail_conn);
    UTL_SMTP.quit(l_mail_conn);
    END;
    ***p_message is a prameter passed to this procedure..
    Can i obtain the result in the form i have it in my table. which has three columns. I want to display the three columns as it is with teh records. ?

    this is not related about this forum but you can use below,
    CREATE OR REPLACE PROCEDURE SEND_MAIL (subject varchar2,mail_from varchar2, mail_to varchar2,mail_msg varchar2)
    IS
    mail_host varchar2(30):='XXXXX';
    mail_conn utl_smtp.connection;
    tz_offset number:=0;
    str varchar2(32000);
    BEGIN
    begin
    select to_number(replace(dbtimezone,':00'))/24 into tz_offset from dual;
    exception
    when others then
    null;
    end;
    mail_conn:=utl_smtp.open_connection(mail_host, 25);
    utl_smtp.helo(mail_conn,mail_host);
    utl_smtp.mail(mail_conn,'[email protected]');
    utl_smtp.rcpt(mail_conn,mail_to);
    utl_smtp.open_data(mail_conn);
    utl_smtp.write_data(mail_conn,'Date: '||to_char(sysdate-tz_offset,'dd mon yy hh24:mi:ss')||utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,'From: '|| mail_from ||utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,'To: "'|| mail_to ||'" <'||mail_to||'>'||utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,'Subject: '||subject||utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,replace_turkish_chars(mail_msg)||utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,utl_tcp.crlf);
    utl_smtp.close_data(mail_conn);
    utl_smtp.quit(mail_conn);
    END;
    Edited by: odilibrary.com on Jun 12, 2012 5:26 PM

  • How to send email using SPUtility.SendEmail method

    hi all,
             I am using SPUtility.SendEmail method to send email to list of users. but i am unable to send it. Code is not throwing any kind of error. Can anyone guide me steps to send email programmatically .
    Regards,
    Milan C.

    Hello Milan, 
    Humm, 
    Problably code is correct, need to speak with System administrator of mail server/exchange to know what rules exist on server mail.
    Verify if server mail validate IP from server to allow send mail. 
    Verify if exist some rule from server mail that validate sender with some domain "[email protected]"
    Verify if Email server have relay active to send Emails externaly
    Verify what type of authentication exist on you server Email, "Anonymous access or Login as password access", https? port number?
    This info is very important to have before you configure emails on sharepoint, to preview problems....  
    André Lage Microsoft SharePoint, CRM and Sybase Consultant
    Blog:http://aaclage.blogspot.com
    Codeplex:http://spupload.codeplex.com/http://simplecamlsearch.codeplex.com/

  • How to send FAX using JSP

    Hi All
    I have a requirement in my JSP application to send documents stored on a system by FAX to a fax machine, I had also the requirement to send mails but that was solved using JavaMail. But is there any method through which a FAX can be sent to a FAX machine using JSP.
    Please help
    Swaraj

    I want to send a message from a system to the client in which he prefer the mode of receiving the message by either E-mail,Phone ,Fax or Mobile.
    Plz send me the source .
    Swami.N

  • How to send email using u201CSO_DOCUMENT_SEND_API1u201D without attachment.

    Dear Expert,
    I am using the folowing code to get the content of smartform as otfdata :
          CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
            EXPORTING
              formname           = v_formname
            IMPORTING
              fm_name            = v_fm_name
            EXCEPTIONS
              no_form            = 1
              no_function_module = 2
              OTHERS             = 3.
          CALL FUNCTION v_fm_name
            EXPORTING
             control_parameters         = control_parameters
             output_options             = output_options
          orderadm_h = orderadm_h
          activity_h =  activity_h
          status_i = status_i
          working_set_e_s_bbp = working_set_e_s_bbp
          language = l_langu  "sY-LANGU
           IMPORTING
             document_output_info       = document_output_info
             job_output_info            = job_output_info
             job_output_options         = job_output_options
           EXCEPTIONS
             formatting_error           =  1
             internal_error             =  2
             send_error                 =  3
             user_canceled              =  4
             OTHERS                     =  5
    How can I send the data in job_output_info-otfdata in the email body without putting it into attachment?
    I am using the function u201CSO_DOCUMENT_SEND_API1u201D.
    I am sending also a normal text in the email and I want to put the data in the job_output_info-otfdata at the end of the text.
    Thank for very much in advance.
    Best regards
    Ahmed Hadi

    Hi Ahmed,
    I believe this blog will help you:
    http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417800%29ID1330314450DB01968839116473008128End?blog=/pub/wlg/2273
    Kind regards,
    Garcia

  • Sending email using jsp

    i want to send content of a input text area to particular email id
    pls replay to [email protected]

    check your mail

  • 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 using forms in cq5 to anonymoys user?

    Hello,
    I need to send mail from a popup form in CQ5.6 to anonymous users on any domains like gmail,yahoomail etc.
    I config the admin console properties of the DAY CQ Mail service.
    SMTP server details:-smtp.gmail.com
    port 465
    I create a form on a page ans define action as MAIL.After sending the mail it will redirect to the thank you page.
    My concern is when i am submitting the mail via send button it will not work.I am not getting any response in inbox of the user.
    Do anyone have idea for the same?
    Thanks in advance

    If your form is running on a box which can mail from the command line you can also do it from a host command. For example, we mail from our web forms solaris middle tier with
    HOST('echo "First line of text'||chr(10)||
    'Second Line of text " | mailx -s "Subject" Address');
    Solaris automatically sends this to our exchange server identified as mailhost in the hosts file.

  • Send email used output management in TM

    Dear expert,
            we has a requirement to send a email in the tm , as we know tm provide this function in the output mangement,
    but i don't know how to do this, can anyone tell how to send email used output mangement in the tm, thank you.
    Message was edited by: Michael Appleby

    Hi mansoor,
    <EmailAccounts xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"
    EmailMimeCharset=""
    NotificationMode="EMAIL">
         <EmailAccount>
              <Name>Default</Name>
              <GeneralSettings>
                   <FromName>BPEL POC</FromName>
                   <FromAddress></FromAddress>
              </GeneralSettings>
              <OutgoingServerSettings>
                   <SMTPHost>mail.oracle.com</SMTPHost>
                   <SMTPPort>25</SMTPPort>
              </OutgoingServerSettings>
              <IncomingServerSettings>
                   <Server>mail.oracle.com</Server>
                   <Port>993</Port>
                   <Protocol>IMAP</Protocol>
                   <UserName>xxxxxx</UserName>
                   <Password ns0:encrypted="false" xmlns:ns0="http://xmlns.oracle.com/ias/pcbpel/NotificationService"></Password>
                   <UseSSL>false</UseSSL>
                   <Folder>Inbox</Folder>
                   <PollingFrequency>1</PollingFrequency>
                   <PostReadOperation>
                   <MarkAsRead/>
                   </PostReadOperation>
              </IncomingServerSettings>
         </EmailAccount>

  • How can I send email using two different email address that both link back to my one exchange account on my Ipad mini

    How can I send email using two different email address that both link back to my one exchange account on my Ipad mini? 
    On my PC I simply have a master return email address and use a POP for the secondary address.  Both are through the one exchange account without a problem.  I need to be able to do the same on my Ipad.

    Ah, I should have made that clear.  My domain didn't come from google.  It was purchased at and is hosted at dreamhost, but I haven't used their email servers in years - I just route everything through gmail.  I actually have a bunch of domains (with websites).
    Gmail has an option that lets someone with custom domains send (and receive) email through gmail using the custom domain once Google confirms proper ownership of the domain (to prevent spammers and such).  Gmail has a setting for "send email as" which allows gmail to be sent using a custom domain as the sender.  I'm pretty sure Apple's old mobileme had this feature too, but I didn't use it.

  • How to remove error 59 which occurred while using Send Email Using Smtp Client .VI in Labview 2013.

    Hi,I am trying to run Send Email Using Smtp Client .VI in Labview 2013 examples ,but it gives error 59.Please can anyone suggest how to remove the error.The printscreen is attached below.
    Solved!
    Go to Solution.
    Attachments:
    error.docx ‏310 KB

    Thanks for the help,but i have set the parameters right but still it does not work for me.Please suggest me reasons and how to correct them.
    Attachments:
    error.docx ‏270 KB

Maybe you are looking for

  • Report for Daily Incremental

    Hi, I just want to know the volume size of daily backup , How i can make this report or get through a query for last 4 weeks. Regards Usman Ghani Usman Ghani - MCITP Exchange 2010

  • How can I see song lyrics in iOS 8?

    In the past I've been able to add lyrics to my music in iTunes and then see those lyrics in the music app after syncing my iPhone or iPod... There is an option in my setting to view lyrics which I have turned on and yet I can't see the lyrics I've ad

  • Photoshop Elements 12 installation error on windows causing rollback-help needed please

    I am installing Photoshop Elements 12 on my windows laptop. When almost done an error occurs and it starts rollback and the installation fails. I consulted the troubleshooting guide which suggests to go to C://Program Files(x86)/Common Files/Adobe/OO

  • Case insensitive search working in dev but not in prod

    Hello All, I had set the CASE_SENSITIVE_CHARACTER_COMPARISON parameter as OFF in NQSConfig.ini file for enabling the case insensitive search in OBIEE. This setup is letting me do the case insensitive search in Dev env but the same doesnt work in prod

  • My new MacBook Pro shut down and won't turn on.

    I connected it to the charger and there is no light to indicate that it's charging . What do I do ? Should I be really worried ? I just got it about a month ago