1

I have a LAMP stack set up on a Debian 8 (jessie) machine. I'm trying to find a way of intercepting all outgoing mail sent by PHP (through sendmail) and instead of sending it out, deliver it to my local inbox (to the local user). I don't want to send anything to the outside world, I only want to be able to see the content of a message through my terminal.

I know that this works with Postfix, but I can't install Postfix on my machine because it conflicts with Exim4 and I don't want to make too many changes to my dev. server.

Can this be done and how?

johny332
  • 33
  • 1
  • 1
  • 3

1 Answers1

3

You have to create the router that redirect outgoing messages:

intercept:
  driver          = redirect
  domains         = !+local_domains
  data            = auditor@local.tld
  pipe_transport  = address_pipe
  no_more

Place that router at the very beginning of begin routers section to ensure each message will be proceeded. When message addressed to the outer domains fall into that router, it will replace original recipient(s) with auditor@local.tld. You can also implement white/black lists of recipients that will be checked by router. Say, if recipient belongs to the white list, then message will not be intercepted while all other will be.

Kondybas
  • 6,964
  • 2
  • 20
  • 24