views:

845

answers:

4

I have a requirement to delay mail delivery through an SMTP Relay.

i.e.

Mail message is successfully recieved at time T. Forward Message to destination at time T+4hours.

Is this possible in sendmail or any other SMTP Relay.

Deployment platform is IBM AIX.

A: 

I'm not a network admin so I don't know the features, but we use PowerMTA and it does quite a bit. Check it out.

Joshua Belden
A: 

I believe you want to use an SMTP message queue to provide deferred delivery. The specifics of exactly how in your implementation are beyond my knowledge, though.

McWafflestix
+1  A: 

You should've been at least a little more specific in your question. I'll just throw in some suggestions anyway.

If you just want to deliver mail every four hours, you have to run sendmail in queue-only mode (QUEUE_MODE="cron"; in sendmail.conf) and set up the queue to be run every four hours (QUEUE_INTERVAL="4h";). I think, this only applies to debian-like systems, but the principle is the same anywhere - you set the queue mode to cron (this is actually controlled by the arguments, with which you start sendmail) and then you process it periodically.

If you want to just delay mail delivery, there is also a number of ways to do it, depending on why you want to do it. One popular solution is greylisting, it does just the following - when a host connects to your MTA (sendmail, f.ex.), it gets bounced with the prompt to try again in some time interval. A properly configured mailer will just do that - it will try sending the mail again and eventually the message will be accepted and delivered (or forwarded). Most of the spam bots, on the other hand, will not try to resend the message upon receiving an error. If you need greylisting on sendmail you can read up here: http://www.greylisting.org/implementations/sendmail.shtml

Hope this helped at least a bit.

EDIT:

Ok, so now I see what you need doing. Here is the possible solution using sendmail (I've been dealing with sendmail in one way or another for years now, so.. :P): You use two of them.

The first one just receives mail and queues it and (and it is important) it does NOT get to process the queue. The second sendmail instance runs a separate queue and its QUEUE_MODE is set to daemon or cron (say, every minute). Now all you need is to write an external script, that would move the mail from the first queue to the second, once the "age" of the message is reached. Since queue items are just files, it is an easy task, done in a few lines of, say, perl (hell, a shell script can do that, too). Moving queue items from queue to queue is as easy as moving files from directory to directory. Please note, that this technique is widely used in mail processing solutions, such as, say spamassassin, so its not some weirdness, conjured by my deseased mind :P

Hope this gives you a hint or two.

shylent
I'll go back and clarify my question, but neither of these solutions will work unfortuantely.If mail arrives at time t, I need it to be forwarded at time t+4hours.Grey listing will not work as the mail needs to be accepted and queued by the relay.
Peauters
Yes, that makes it more clear. While at first I was somewhat puzzled as to how to do it (it is not something people would usually do with their mail), a possible solution sprang to my mind.
shylent
A: 

You can do this if your MSA supports RFC 4865. Unfortunately, since this is a fairly recent spec, it is unlikely to be implemented.