0

Is there a way in sendmail to reject messages with To: headers that don't include a domain name, rather than masquerading them?

We have a broken client that uses the correct recipient address in the envelope, but sometimes sets the header To: field from an internal address book, so the envelope To: will be "test@example.com", but the To: header will be "Test User@mailserver.example.com".

Is there any way in sendmail to reject such a message without writing a milter to catch that case? The client will unfortunately not be fixed, but it is perfectly acceptable to not deliver such messages.

The scenario we are trying to avoid is where adam@example.com sends an email to beth@example.com using the broken client and CC's "Test User". If beth@example.com replies to all, she will get an ugly error trying to send mail to "Test User@mailserver.example.com".

We can not masquerade to a saner domain name, as the server holds multiple virtual domains, and we can't assume which domain the recipient will be in.

Dave M
  • 4,514
  • 22
  • 31
  • 30
  • Have you considered using milter like MIMEDefang? MIMEDefang uses perl script for filtering. see https://mimedefang.org/ – AnFi Jun 27 '20 at 04:59

1 Answers1

0

Add to access file:

To:mailserver.example.com ERROR:5.7.1:550 Bad recipient
dinoex
  • 141
  • 5