Sendmail includes a facility for plugging in custom mail filters, called milters. It's documented here. Dupidfilter is a plug-in that checks whether the message-id has been seen before.
Version 0.50, ??sep2015:
This is very abbreviated, intended mainly as a reminder for those who have worked with milters before. If it's your first milter, you should look on the web for more thorough documentation. Also, these instructions are pretty specific to FreeBSD, and will have to be adapted for other OSs.
If you don't see MILTER in the compilation options, you will have to re-build sendmail.
sendmail -d0.1 -bt < /dev/null | grep MILTER
Rebuild and install sendmail.cf.
# dupidmilter unix:/var/run/dupidmilter.sock
dupidmilter_enable="YES" dupidmilter_flags="" dupidmilter_socket="unix:/var/run/dupidmilter.sock"
ACME Labs / Software / dupidmilter