in reply to Email delay delivery option with Perl

Thanks for your responses!

Ww, im not sure how Outlook does it. I was hoping that i could give my message (ie "email entity" %-) ) to the mail server and tell it to hold it until specified datetime. I was hoping that the server would store it until the later date, not that i would store it till i want to send it.

Ken, i thought of sleeping too, but unfortunately it isnt a good idea in this case, i think. The script would need to be run every time i want to send a delayed message, and if the previous instance of the script is sleeping it would create a 2nd running instance. Then the 3rd, 4th etc etc. It makes me wary to have so many sleeping scripts. Besides, if the server needs to be restarted (which does not happen often, but enough to take it into consideration), all those emails will be lost.
  • Comment on Re: Email delay delivery option with Perl

Replies are listed 'Best First'.
Re^2: Email delay delivery option with Perl
by ww (Archbishop) on Feb 24, 2012 at 18:56 UTC
    Is the mailserver yours (and yours exclusively)?

    This would still be storing the message "somewhere" -- which you excluded in your OP -- but if you own the mailserver, it should not be all that hard to modify your existing code (or code in Mail::Sendmail to interpose a delay between creation and transmission. Just for example, countdown timers are a well-established, well-documented, and simple technology.

Re^2: Email delay delivery option with Perl
by kennethk (Abbot) on Feb 24, 2012 at 20:00 UTC
    Like I said, it depends on how robust a solution you want/need. If you need a more robust system, I would stash e-mails in a database along with a send time. Then I'd run a cron job that looked in the database for messages that were ripe to send. The message has to persist between generation and sending somehow; sleep keeps in in memory and either a database or possibly Storable stashes it on disk.
    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.