java sending mail automatically

核能气质少年 提交于 2019-12-06 02:18:38

Check out java.util.Timer and if it is not enough for you read about Quartz - the pure java cron compatible scheduler.

Quartz seems better option.This tutorial might help you to set up quartz.

try

public class SendEmail extends TimerTask{

public static void main(String[] args){
Timer t = new Timer();
t.schedule(new SendEmail(), 0, 9000); //send email every 9 seconds
}

@Override
public void run() {
    // TODO Auto-generated method stub
    //Your email syntax here
}

}

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!