I am installing Bugzilla and I want to prevent it from sending out e-mails, which instead should be sent to a user on the local machine.
I have this line in my /etc/mail/sendmail.mc:
FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable.db')
I added the following line to the top of /etc/mail/virtusertable (the rest is comments):
@mydomain.com myusername
I then ran the following comands:
$ makemap hash /etc/mail/virtusertable < /etc/mail/virtusertable $ m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
I then restarted the sendmail server. However, when I send an e-mail to [email protected] via the mail command, I still receive it in my web-based inbox, which is not what I want. I want it to be delievered only to myusername on the local machine.
Please do yourself, and the world, a favour and replace Sendmail with something easier to configure and maintain, like Exim or Postfix. I would normally vote down answers that said "use a different product", but in the case of Sendmail, I think it's worth the risk. Sendmail is very complex to configure compared to modern MTAs and should only be used if you have an existing complex Sendmail infrastructure and you have considerable Sendmail experience.
Also, I don't know if it's a typo or not, but you have
Notice the endmail.cf, rather than sendmail.cf.
I took David's advice and installed Postfix. It was amazingly easy to set up. I followed these instructions to configure main.cf, then all I had to do was add the following line to /etc/postfix/virtual:
Then execute the following commands:
And voilà! All mail sent from the local machine to any address @mydomain.com is instead sent to the local user myusername.