Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8533357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:56:48+00:00 2026-06-11T09:56:48+00:00

Hello Guys !! I developed a small application to send mail to particular id

  • 0

Hello Guys !!
I developed a small application to send mail to particular id on clicking submit Button. Now As per my needs:

  1. I have to send mail automatically at particular time of day.
  2. To clarify this ,mail Should be sent to particular id at particular time .

So what I need is to make my process automatically .

Any suggestions will be highly appreciated..

protected void processRequest(HttpServletRequest request,
        HttpServletResponse response)
        throws IOException, ServletException {final String err = "/error.jsp";
    final String succ = "/success.jsp";


    String to = request.getParameter("to");
    String subject = request.getParameter("subject");
    String message = request.getParameter("message");
    String login = request.getParameter("login");
    String password = request.getParameter("password");

    try {
        Properties props = new Properties();
        props.setProperty("mail.host", "smtp.gmail.com");
        props.setProperty("mail.smtp.port", "587");
        props.setProperty("mail.smtp.auth", "true");
        props.setProperty("mail.smtp.starttls.enable", "true");

        Authenticator auth = new SMTPAuthenticator(login, password);

        Session session = Session.getInstance(props, auth);

        MimeMessage msg = new MimeMessage(session);
        msg.setText(message);
        msg.setSubject(subject);


        msg.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
        Transport.send(msg);

    } catch (AuthenticationFailedException ex) {
        request.setAttribute("ErrorMessage", "Authentication failed");

        RequestDispatcher dispatcher = request.getRequestDispatcher(err);
        dispatcher.forward(request, response);

    } catch (AddressException ex) {
        request.setAttribute("ErrorMessage", "Wrong email address");

        RequestDispatcher dispatcher = request.getRequestDispatcher(err);
        dispatcher.forward(request, response);

    } catch (MessagingException ex) {
        request.setAttribute("ErrorMessage", ex.getMessage());

        RequestDispatcher dispatcher = request.getRequestDispatcher(err);
        dispatcher.forward(request, response);
    }
    RequestDispatcher dispatcher = request.getRequestDispatcher(succ);
    dispatcher.forward(request, response);

}

private class SMTPAuthenticator extends Authenticator {

    private PasswordAuthentication authentication;

    public SMTPAuthenticator(String login, String password) {
        authentication = new PasswordAuthentication(login, password);
    }

    protected PasswordAuthentication getPasswordAuthentication() {
        return authentication;
    }
}

protected void doGet(HttpServletRequest request,
        HttpServletResponse response)
        throws ServletException, IOException {
    processRequest(request, response);
}

protected void doPost(HttpServletRequest request,
        HttpServletResponse response)
        throws ServletException, IOException {
    processRequest(request, response);
}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:56:50+00:00Added an answer on June 11, 2026 at 9:56 am

    In addition to Quartz there is also the Timer API ( http://java.sun.com/j2se/1.4.2/docs/api/java/util/Timer.html )

    A facility for threads to schedule tasks for future execution in a background thread. Tasks may be scheduled for one-time execution, or for repeated execution at regular intervals.

    You put the timer code into a new servlet that you add to your
    webapp. Or add your code to an existing servlet in your webapp.

    There are plenty of other open source scheduling API’s as well….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello guys i have a small problem at my console application i have a
Hello guys I have a problem with my application involving Lucene java library and
Hello guys I have 1675 line Code. Want to when user click button textbox.text
hello guys i need small help in understanding file system of android Now in
Hello guys I'm creating an application that have a widget the application and the
Hello guys i have dataform in silverlight 4 project item source is: ItemsSource={Binding Data,
Hello Guys! I started learning python GUI development. Let's say I have this script:
Hello guys sorry if the question looks stupid to you. i have 3 tables
Hello guys i have a MSChart and i have some arrows on chart exactly
* Hello Guys..! * Normally a java program needs main() function to execute the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.