0

I need to alias all mail coming from another SMTP server to this one account "myinbox". The system in question is to receive all e-mail on the domain, if that's any help. http://william.shallum.net/random-notes/sendmailredirectallmailfordevelopment is a template for the beginning of a solution, but that routes everything (including outgoing and internal mail) to that one account, and trying to understand how these R rules work is making my head spin. I think the answer is in sendmail.mc rather than any Procmail configuration. So I think what I generally don't want the filter to do is:

  • Interfere w/any outgoing e-mail
  • Interfere w/any internal e-mail Sometimes some cron job causes "root" to mail to "root". I don't want these to go to myinbox.
  • Cause infinite loops Who does? Bounce messages and any DSNs come to mind.

I'm running Sendmail 8.13.1 and Procmail 3.22.

Angus
  • 13
  • 6
  • Simply use the virtualuser table and create a catchall account `*@example.com myinbox` ; as long as your hostname is not `example.com` mail messages sent from within your server will be dropped in the mailbox of valid user accounts. – HBruijn Jun 03 '14 at 15:26
  • Yep! It even seems to allow for internal mail to pass unmolested. Thank *God* the solution doesn't involve that R rule insanity. And thank you. – Angus Jun 03 '14 at 19:08
  • I've just added my comment as a proper answer, which you can accept to close your question. From what I gather the document you linked to has a complex/clever solution to deal with bad development practices. That solution boils down to, "we use production data for testing and want to prevent email messages generated by testing to reach real customers" so rather then scrubbing your test data mangle sendmail to redirect all outgoing smtp messages to a single local mailbox. – HBruijn Jun 04 '14 at 10:47

1 Answers1

2

What you want is a catch-all email account. The sendmail virtualuser table allows you to set that up quite handily:

# sendmail.mc
FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable.db')dnl

and

#  /etc/mail/virtusertable
#  makemap hash /etc/mail/virtusertable <  /etc/mail/virtusertable
# 
# <email address>      <local account>
@example.com          myinbox

as long as your hostname is not example.com mail messages sent from within your server will be dropped in the mailbox of valid user accounts. i.e. mail -s test root will get delivered to the mailbox of root, mail -s test root@example.com should go to myinbox.

HBruijn
  • 77,029
  • 24
  • 135
  • 201