You can view the tutorials best in Google Chrome, Mozilla Firefox, Opera, higher version of Internet Explorer

Send Java EMail in Specific Time Interval Automatically & Dynamically

Core Java » On Oct 7, 2012 By Sivateja

Let us see how to send automatic and dynamic email using Java, this application will send email in fixed interval of time, even if you want you can change this application to send email every day at particular time :-), to wish your friends/family.

Directory Structure


  • Run to start this application
  • First time email will sent after 2 seconds and repeats every 10 seconds until you stop your application
  • Just change .properties file and change what ever you want, you no need to touch any .java files :-)
  • You no need to touch

Jars Required

  • mail.jar
  • activation.jar
  • commons-email-1.0.jar

Download these jars…..



By [ Java/J2EE Developer & Web Designer ]
Founder of - Indian, lives in United States. You can contact me at sivateja [at]
Follow me on


5 Responses to “Send Java EMail in Specific Time Interval Automatically & Dynamically”
  1. hi frnd,this is really awesome tutorial for java developers ,actuallly when iam trying to execute this example im getting error follws….

    Email Sent Succesfully…
    javax.mail.SendFailedException: Sending failed;
    nested exception is:
    class javax.mail.MessagingException: Unknown SMTP host:;
    nested exception is:
    at javax.mail.Transport.send0(
    at javax.mail.Transport.send(
    at JAVAEmail.GMailServer.sendMail(
    at java.util.TimerThread.mainLoop(Unknown Source)
    at Source)

    error….plz help in execution by sending an email to my mail id ,
    thanks in advance

  2. ram says:

    Hi frnd
    I also practiced wit this code its really helpful ,Thanks

  3. neha says:

    sir from where i can download file….please give me the respective link..

  4. Jinshad says:

    Gud job….. Thanks a lot….

  5. Hareesh says:

    I am getting the following error plse help to slove this

    Scheduler Starterd…

    Exception in thread “Timer-0″ java.lang.NoClassDefFoundError: com/sun/mail/util/LineInputStream
    at javax.mail.Session.loadProvidersFromStream(
    at javax.mail.Session.access$000(
    at javax.mail.Session$1.load(
    at javax.mail.Session.loadResource(
    at javax.mail.Session.loadProviders(
    at javax.mail.Session.(
    at javax.mail.Session.getDefaultInstance(
    at emial.GMailServer.(
    at java.util.TimerThread.mainLoop(


By posting your answer, you agree to our comments policy.
Most Recent Tutorials
Hibernate Recent Posts
Spring Recent Posts
Struts Recent Posts
Recomandded Links
Current & UpComing Tutorials
Sitemap :
spring Hibernate struts Json Ajax Log4j Log4j coreJava Servlets Web Services

  Web Services [ SOAP ], JSP
Facebook_Java4s  Twitter_Java4s  GooglePlus_Java4s  Youtube_Java4s 
© 2010 - 2014 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.