Scheduling a time in the future to send an email in Java or Python

后端 未结 6 1871
执笔经年
执笔经年 2021-01-27 05:11

I\'m writing an application and I\'d like it to somehow schedule an email to be sent at a later date (likely an hour after it is run). The programming language will be Python or

6条回答
  •  天命终不由人
    2021-01-27 05:49

    I don't think standard SMTP protocol has such a feature, so if you want to be platform-independent, you will have to search for another solution.

    How about writing your message to a queue (local database, for example) with a timestamp and then have some program watching it periodically and send pending emails out?

    Is the delay an exact timedelta or is it "1-2 hours later"? If it is the latter, than you can have an hourly job (cronjob starting every hour or a background job sleeping for an hour), which would then send out the emails.

提交回复
热议问题