We have a stock PHP ecommerce application that sends notification emails out whenever a successful purchase is made. We want one of the notifications to be sent 2 weeks after the purchase is made.

There are two approaches to this:

  1. Set up a queuing system using cron, php etc.. this will also involve modifying the 3rd party php ecommerce application we're using.
  2. Find a way to make sendmail queue it up to be delivered two weeks from the point of adding it.

What I'd like to know is if there's a header or something clever like that I can set on the message to delay the sending of it.. perhaps there's a plugin for sendmail that can achieve this?

Basically, I'm looking for a more hands-off way of delivering a message rather than hacking up the php as that would be a fairly big job whereas tinkering a bit with sendmail might be a lot easier.

The manpage for sendmail on the server in question states it's some kind of postfix wrapper:

sendmail - Postfix to Sendmail compatibility interface

  • A fairly nasty hack could be to hack up the php code and use the 'at' command via an exec() call but that really is quite horrid.
    – John Hunt
    Apr 22, 2015 at 10:15

1 Answer 1


Could this be done? Possibly, but with probably more tinkering and hacking of sendmail than you would of the PHP code.

However, after a bit of digging, I found this: "How Can I Delay Mail Delivery"

The drawbacks are that you will have to have a second SMTP server running in QUEUE mode and you will still need to tweak code to make this work.

So, my suggestion is to create a small php or javascript applet that on a predetermined schedule (every day via cron), queries the database for all purchases made two weeks ago and send an email to that customer. This way, you can use your existing server and not have to touch any of the code.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .