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

  • Home
  • SEARCH
  • 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 6065221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:21:59+00:00 2026-05-23T09:21:59+00:00

Never used Java mail before. In my JSF web app, I have an entity

  • 0

Never used Java mail before.

In my JSF web app, I have an entity (followUp) with a property private Date checkDate; that corresponds to an Animal entity. (An Animal has many followup records). Otherwise:

The user must each 3 months create a new record in {followUp} and mark it as checked and supply the date of his action which is “checkDate”. But since the user is so lazy, he does that for only few Animals.
So he actually wants to be alerted by email for Animals that have not been checked for more than 3 months.
Example: I create a followUp record for Animal ‘A’ on 01/01/2011, then on approximatively 01/04/2011, the user receives an Email alerting him to go check Animal B followup.

The web application is running on Local enterprise Network.

All I Know is that snippet :

import javax.mail.*;
import javax.mail.internet.*;

import java.util.Properties;

class SimpleMail {
    public static void main(String[] args) throws Exception{
      Properties props = new Properties();
      props.setProperty("mail.transport.protocol", "smtp");
      props.setProperty("mail.host", "mymail.server.org");
      props.setProperty("mail.user", "emailuser");
      props.setProperty("mail.password", "");

      Session mailSession = Session.getDefaultInstance(props, null);
      Transport transport = mailSession.getTransport();

      MimeMessage message = new MimeMessage(mailSession);
      message.setSubject("Testing javamail plain");
      message.setContent("This is a test", "text/plain");
      message.addRecipient(Message.RecipientType.TO,
           new InternetAddress("elvis@presley.org"));

      transport.connect();
      transport.sendMessage(message,
          message.getRecipients(Message.RecipientType.TO));
      transport.close();
    }
}

Should I create, a Servlet Filter, A Listener, An Application Scoped backing beans, for that purpose? A query that loops on followUp records and returns the last record’s checkDate and compares it to Today date?

Any help will do. Regards.

  • 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-05-23T09:21:59+00:00Added an answer on May 23, 2026 at 9:21 am

    Based on your question history I know that you’re using Glassfish 3 (Java EE 6 with EJB 3.1), so I’d suggest to create a @Singleton EJB with @Schedule method which executes in the background at specified intervals, for example daily at midnight (00:00:00).

    @Singleton
    public class MailReminder {
    
        @Schedule(hour="0", minute="0", second="0", persistent=false)
        public void run() {
            // Do your check and mail job here.
        }
    
    }
    

    That’s it. No further configuration is necessary. For testing purposes you could use

        @Schedule(hour="*", minute="*/1", second="0", persistent=false)
    

    to let it run every minute.

    See also:

    • Java EE 6 tutorial – Using timer service
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've never used Java AWT before and now I've got a piece of code
I'm used to doing Java programming, where you never really have to think about
I've never used regex before, but this java function requires it (shown here: How
I have never used ruby but need to translate this code to java. Can
I've never used Java for graphics before so I am currently trying to learn.
What does the >> sign mean in Java? I had never seen it used
Never used a cache like this before. The problem is that I want to
I have never used octal numbers in my code nor come across any code
I've never used the Global Temporary Tables however I have some questions how they
I've never used CI tools before, but from what I've read, I'm not sure

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.