check_mailq: Add sudo support

This addition is based on a patch contributed by Christopher Schultz.

Closes #1099.
Closes #1171.