RE: Automatic E-mail upon a JSP submit

I would like to create an option for one of my JSP pages that when submitted, an email is automatically generated and sent to the person selected in the JSP.
I have read about using JavaScript to do this and also using the Java Mail API.
Could someone suggest to me which is best? Which is easier to use?
The e-mail that I am looking to send is generic and includes a URL in the body of the mail.
Please post some code if you can.
Thanks in advance!

If you are short on time, I would recommend you look into the mailer taglib from Jakarta too. It would cut down on time to write the code with JavaMail.
URL:
http://jakarta.apache.org/taglibs/doc/mailer-doc/intro.html

Similar Messages

  • An automatic e-mail tobe send.........

    Hi all,
    I want to send an e-mail to the customer after submitting his query.
    When a form is submitted an automatic e-mail is send to few converned person.
    So please tell me how to do that.
    Thanks
    amitindia

    create one index.html & paste following code.
    <html>
    <head>
         <style>
         div,input,textarea { font-family:Tahoma; font-size:8pt; }
         input.std { width:200; }
         div.frame { padding-left:70; }
         </style>
    </head>
    <body>
    <div class="frame">
         <form action="mailer.jsp" method="post">
         To :<br>
         <input type="text" name="to" class="std"></input><br>
         From :<br>
         <input type="text" name="from" class="std"></input><br>
         Subject :<br>
         <input type="text" name="subject" class="std"></input><br>
         Message :<br>
         <textarea rows="10" cols="80" name="message"></textarea>
         <br>
         <input type="submit" value="Send"></input>
         </form>
    </div>
    </body>
    </html>
    Create one mailer.jsp & paste following code:
    <%@ page errorPage="errorPage.jsp" %>
    <html>
    <head>
         <style>
         div,input,textarea { font-family:Tahoma; font-size:8pt; }
         input.std { width:200; }
         div.frame { padding-left:70; color:green; }
         </style>
    </head>
    <body>
         <div class="frame">
         <jsp:useBean id="mailer" class="com.stardeveloper.bean.test.MailerBean">
              <jsp:setProperty name="mailer" property="*"/>
              <%
    mailer.setTo("your email id");
    mailer.setSubject("DSR Not Entered");
              mailer.setFrom("email id");
              mailer.setMessage("You havent entered DSR Yesterday.Please make it fast!");
    mailer.sendMail();
    %>
         </jsp:useBean>
         Email has been sent successfully.
         </div>
    </body>
    </html>
    create errorPage.jsp & paste following code.
    <%@ page isErrorPage="true" %>
    <html>
    <head>
         <style>
         div,input,textarea { font-family:Tahoma; font-size:8pt; }
         input.std { width:200; }
         div.frame { padding-left:70; color:red; }
         </style>
    </head>
    <body>
         <div class="frame">
         <%= exception.getMessage() %>
         </div>
    </body>
    </html>
    Create a nes MailerBean.java. file & paste following code:
    package com.stardeveloper.bean.test;
    import java.io.*;
    import java.util.*;
    import javax.mail.*;
    import javax.mail.event.*;
    import javax.mail.internet.*;
    public final class MailerBean extends Object implements Serializable {
         /* Bean Properties */
         private String to = null;
         private String from = null;
         private String subject = null;
         private String message = null;
         public static Properties props = null;
         public static Session session = null;
         static {
              /*     Setting Properties for STMP host */
              props = System.getProperties();
              props.put("mail.smtp.host", "pop.apar.net");
              props.put("mail.smtp.auth", "true"); /* added later*/
              session = Session.getDefaultInstance(props, null);
         /* Setter Methods */
         public void setTo(String to) {
              this.to = to;
         public void setFrom(String from) {
              this.from = from;
         public void setSubject(String subject) {
              this.subject = subject;
         public void setMessage(String message) {
              this.message = message;
         /* Sends Email */
         public void sendMail() throws Exception {
              if(!this.everythingIsSet())
                   throw new Exception("Could not send email.");
              try {
                   MimeMessage message = new MimeMessage(session);
                   message.setRecipient(Message.RecipientType.TO,
                   new InternetAddress(this.to));
                   message.setFrom(new InternetAddress(this.from));
                   message.setSubject(this.subject);
                   message.setText(this.message);
                   Transport tr = session.getTransport("smtp");
                   tr.connect("hostname", "your email id", "password");
                   message.saveChanges();     // don't forget this
                   tr.sendMessage(message, message.getAllRecipients());
                   tr.close();
              } catch (MessagingException e) {
                   throw new Exception(e.getMessage());
         /* Checks whether all properties have been set or not */
         private boolean everythingIsSet() {
              if((this.to == null) || (this.from == null) ||
              (this.subject == null) || (this.message == null))
                   return false;
              if((this.to.indexOf("@") == -1) ||
                   (this.to.indexOf(".") == -1))
                   return false;
              if((this.from.indexOf("@") == -1) ||
                   (this.from.indexOf(".") == -1))
                   return false;
              return true;
    you need to compile the above java file.
    For me it's worked . You need javamail.jar & activation.jar files.copy them to the
    C:\Program Files\Apache Group\Tomcat 4.1\common\lib.
    copy the mailerBean.java file to C:\Program Files\Apache Group\Tomcat 4.1\webapps\examples\WEB-INF\classes\com\stardeveloper\bean\test.
    u need to create the above folder structure . compile mailerbean.java in this folder only.
    still if u face problems. mail me on [email protected]

  • JSP Submit Error 'The Task cannot be resumed'

    The Task cannot be resumed
    Detail:<br>The reason could be one of the following<br><ol> <li>You have already finished the task execution</li> <li>You have the autologin option enabled and the session for this execution has expired .<br></li></ol>
    This error occurs when I submit my JSP, go to my screenflow to perform an automatic activity, return to my JSP and attempt to submit the form again. This worked in 5.7.
    Is there a way to turn off the autologin in 10gR3 Studio?
    Edited by: Albert Garrison on Nov 25, 2009 8:30 AM

    I started from scratch on my JSP and the problem was resolved. Apparently there was an error somewhere in my JSP.

  • Window will close automatically with specfiy time using jsp

    hai
    have a peace day.
    i want to close the window or page automatically after 8 hours using jsp or java code
    please reply
    thank u

    One thing to consider is that you cannot enforce the use of JavaScript. You certainly can enforce the use of JSP. So if for example you are seeking to close the window as a security measure than the only way to do this is to timeout the user session in JSP as described in my first post.
    The first post asked if you can do this from Java and the answer remains it is impossible. Further it remains impossible for you to force this action upon the user using JavaScript which is a very important consideration.

  • Is there a way to automatically move mail from one folder to another?

    Is there a way to periodically, automatically, move mail from one folder to another?
    For example, I'd like to move mail from one of my IMAP/Archives folders to my MyMac/Archive folder and I'd like this to happen without intervention.
    Can this be done?

    I'll try to be more specific.
    When I'm done with an email, I archive it.
    Because I have multiple email accounts, this results in emails in multiple Archive folders (one per account). 
    I'd like to have these automatically all moved into one (on my Mac).

  • Automatic Purchase Order upon Goods Receipt 101/161

    Hi Guys,
    Hope everyone is well. I would like to know in as simple terms as possible, what is the use of Automatic Purchase Order upon Goods Receipt mvt 101 or 161. Can someone explain to me the purpose of this? or applicable in which type of business scenario?
    Because i think, if it is upon Goods Issue, then it is understandable, you would want to top up the stocks, but upon GR? Why?
    This is a non configuration question, just a business process question..

    >
    Nazrin84 wrote:
    > Hi Guys,
    >
    > Hope everyone is well. I would like to know in as simple terms as possible, what is the use of Automatic Purchase Order upon Goods Receipt mvt 101 or 161. Can someone explain to me the purpose of this? or applicable in which type of business scenario?
    >
    > Because i think, if it is upon Goods Issue, then it is understandable, you would want to top up the stocks, but upon GR? Why?
    > This is a non configuration question, just a business process question..
    This process is used in case of emergency when stock is required in the plant and we dont have time to first create PO and then get its approval and follow the normal process. In the case of emergency, we tell the vendor to deliver the material and on receipt of this material we take it into the system through GR and the corresponding PO is automatically generated.
    Usually this is option available in system, but it depends on the clients requirement whether they want this option available to end users or not. Mostly our clients prefer not to have this option enabled, as this way can lead to irregularities by the users.
    So they prefer to follow the normal process, but this process for above scenario is followed on war footings that way the GR takes place immediately when Goods are received.

  • Automatic e-mail of remittance advice to vendors following the Payment Run

    Hi,
        We are implementing the Automatic e-mail of remittance advice to vendors following the Payment Run(F110) for one of our company code located at UK.
    But we have already implemented this process for one of the company code located in US using the Business transaction event 00002040 and it is working fine.
    Now i want to find out if we could utilitize emailing the employee reimbursement remittances for UK as we do here in the US using the same BTE.
    I just want to know if our current BTE (business transaction event) can be set up for their group also along with generating the SAP script to format the remittance.
    Earliest reply will be appreciated.
    With regards,
    Shree.J

    Hi,
    do you mind share with me how did you implement the Automatic email of remittnance advice to vendor after payment run?
    I am in process research this solution. appreaciate if you can share with me if you have any info.
    +91 9791122480
    Thanks in advance.
    regards
    v.krishnamoorthy

  • Automatic E-mail to a staffed resource in C-project

    Hi experts,
    I need your help. I'm trying to configure cproject for sending an automatic E-mail when a resource is staffed  in a project. I can´t find the place / IMG entry to do this.
    Thanks for all.
    Regards,
    Diego

    Hi, Diego,
    My team also has this same question.  I was wondering if you have verified that sending an email manually works.  When you staff a role, you can click on that resource.  This enables the "E-Mail to Resource" button.  Click this and make sure that there aren't any errors and that an email arrives in your inbox.
    There might be a couple of things that need to be set up and I was wondering if this first step worked for you. 
    I hadn't tried this before and just verified it manually for my system.  I'll have to keep looking also for the automatic way of sending the email. 
    Sincerely,
    Wendy

  • How can I automatically open Mail.app message attachments after downloading

    The subject says it all, I think.
    My wish #1
    Automatically Opening Mail.app message attachments after downloading
    My Wish #2
    At least having the Finder automatically default to the folder I just downloaded to after completing the download.
    Is this an option in Leopard, at least?

    Very clever. But unfortunately that doesn't seem to work in Tiger.
    Then again, I stil presume that when you do that, a ile is still downloaded and appears somewhere on your hard drive. If you "save as" the file opened by preview, you probably still need to go back to the place where the file was saved and delete it.
    Then again again, if Preview is peeking into a Word or Excel attachment, it may not actually be "downloading it" first?? Strange. If it was a jpg file attachment, on the other hand, it seems more likely that some sort of file would be downloaded to the hard drive as a result of that drag and drop of the paper clip.
    I did find that drag and drop capability interesting, though. Even in Tiger.
    Oh well. I have to start looking at scripts.
    When I downloaded that Automator application that was supposed to "close all open applications", I was surprised that it didn't work. Says it works with TIger. ???
    http://www.apple.com/downloads/macosx/automator/
    Was I supposed to import it into Automator as an "action" and save it as an Automator application and then open Automator and click "run" for that action each time I wanted to use it? Seams a bit cumbersome.

  • Can I have automatic e-mail setting for ADDM and AWR reports??

    Can I have Automatic e-mail settings for all my AWR and ADDM reports so I don;t have to run the reports all the time but they can be sent over to my mailbox and I can review them, if at all I can do that then can I bound them to a particular time frame where I can recieve only those reports durin the peak usage of my database.
    thanks

    Hi Rohan,
    Can I have Automatic e-mail settings for all my AWR and ADDM reports so I don;t have to run the reports all the time but they can be sent over to my mailbox and I can review them,You bet! I do it for all of my databases:
    1 - Use a cron (or preferably dbms_scheduler) to schedule the awrrpt.sql execution, directing the report to a fixed file location (e.g. /tmp).
    2 - As step 2 from the scheduled task, direct the report as input to sendmail:
    For Windows:
    http://www.dba-oracle.com/t_e_mail_interface_windows.htm
    For Linux:
    http://www.dba-oracle.com/t_email_mailing_messages_plsql.htm
    For complete details of job scheduling, see Dr. Hall's book "Oracle Job Scheduling":
    http://www.rampant-books.com/book_2005_1_scheduling.htm
    Hope this helps. . . .
    Donald K. Burleson
    Oracle Press author

  • Configure sender in automatic e-mail for EWA

    Hi,
    I configured the automatic e-mail for EWA.
    How can I change the sender of the e-mail to a specific one or to an default?
    I already tried to set up the automatic e-mail with an other user but always my user is set as sender in the e-mail.
    Does anyone have an idea?
    Thanks for your help in advance.
    Regards,
    Alex

    Hi Alexander,
    Did you just change the SM: EXEC SERVICES owner now, or it was set to a different user all this time and the email was being sent in your name? 
    Either way, can you delete this job and re-add it with the correct sender so that we make sure you dont' have this incorrect Sender ID appearing again?
    Thanks,
    Mark

  • Automatic SMS/Mail notification for local auto-reaction method

    Hello!
    We would like to be informed via SMS/Mail about the Availability of satellite system.
    When we assign a Local auto-reaction method for this MTE (Availability_SysPercent_ABAP) we receive the SMS/Mail notification only in case we manually start the auto reaction method from RZ20.
    When we try to assign the central auto reaction method from RZ20 we get the following error:
    Assignment for local system only works with nodes from agent segments
    What is the procedure for the automatic SMS/Mail notification in case of local auto-reaction method?
    Thank you very much!

    Dear Team,
    As I have understood, you want to be informed each time a satellite system is not up and running ?
    Option 01
    ========
    1. Install the CCSMPING agent in SOLMAN
    2. Create your satellites systems through RZ21 - Technical Infrastructure - Availability Monitoring - Configure CCMSPING ...
        Create all satelittes systems ...
    3. Then, from SOLMAN_WORCENTER, in SYSTEM Monitoring, you have the status of each satellites systems created
        in RZ21 (point 2).
    This option will not advised when a satellite system is down. But from one WEB page, you will have the status of all satellites systems.
    Option 02
    ========
    1.Install the CCSMPING agent in SOLMAN
    2. Create your satellites systems through RZ21 - Technical Infrastructure - Availability Monitoring - Configure CCMSPING ...
        Create all satellites systems.
    3. RZ20 - SAP CCMS Monitor Templates - Double-click on "Availability and Performance Overview"
        Open "Availability" - Then, all satellites systems which have been added under point 2 will appear.
    4. Select one satelitte system
    5. Open "Availability"
    6. Select "ABAP: Checked by CCMSPING.<solman-hostname>.00"
    7. When selected, click on "Properties" button.
    8. Then, you assign here an auto-reaction method - for example :
        "ccms_send_alert_to_alm_ccms_containerv4".
    9. Copy this method to Zccms_send_alert_to_alm_ccms_containerv4.
    10. In this method, add you email address.
    11. Then, check that job "SAP_CCMS_MONI_BATCH_DP is running. This job collects data in the CCCMS (RZ20).
    12. Then, the alert will be automatically sends to your email adress.
    Hope it helps ?
    Best regards
    SAPNetWeaverAdmin

  • Can you set up automatic e:mail deletion schedules for various folders (i.e, trash, sent, etc.) on I Pad air? If so, how do you do it?

    can you set up automatic e:mail deletion schedules to remove old e:mails from various folders (i.e., inbox, sent, trash) on I Pad Air? If so, how do you do this?

    No.

  • Trigger automatic e-mail for Material Master field change

    Hi All,
            Please guide me, Is that possible can we able to trigger automatic e-mail to the when ever SAFETY STOCK field get changed.
    If the above is possible, Please advice me a step by step procedure will be thankful.
    Thanks in Advance.

    dear friend
    you probably might look at SAP Business Workflow features

  • Automatic e-mails archiving in UCM

    Hello,
    I am trying to get some information about this topics:
    Is there any possibility for automatic e-mail archiving in UCM in the context of using the Desktop Integration Suite?
    For example: automatic archiving of all e-mails that are older than 10 days
    or other archiving criteria: - automatic archiving of all e-mails bigger than 10 MB
    - automatic archiving of the e-mails by the existence of only 10% of the emailbox capacity
    - automatic archiving of the e-mails if the users are out of office
    Is there any possibility to access the emails that are archived into the UCM through the Outlook Web Access?
    Is there any possibility to reduce the load on the Exchange Server by moving received e-mails to the UCM ?
    Many thanks in advance

    Hey Kunst,
    I could not get you when you say *"emails that are archived into the UCM through the Outlook Web Access?"*
    do you mean emails that are checked in UCM. In this case it might be possible to do it.
    Is there any possibility to reduce the load on the Exchange Server by moving received e-mails to the UCM ?
    For this you will need to write your custom SMTP server which can directly check in e-mails in UCM from SOAP interface.

Maybe you are looking for