"My unqualified host name (foo.bar) unknown" Problem

Solution 1:

Simply changed:

127.0.0.1     localhost localhost.localdomain
127.0.0.1     foo.bar

To this

127.0.0.1     localhost localhost.localdomain foo.bar

Sendmail looks for a fully qualified domain (FQDN) name and will use the localhost.localdomain in the single line version.

Solution 2:

Simply adding the domain to your hosts files as @rjstelling suggests will only allow your mail to be sent, but it is incredibly unlikely to land in someone's inbox.

In order to send an email that won't be flagged as spam, to say nothing of the receiving server just terminating the delivery attempt or dropping the message, you need to be using a real, registered domain name with working DNS and an MX record.

And that is to say nothing for FCRDNS or any one of the dozens of things that you need to do to run a server whose email might actually be accepted most of the time. [if the internet gods deign to smile upon you even briefly] The true answer is that you probably shouldn't be running your own mailserver because it's simply not worth the work required to keep it in good standing. Look into mail services like SendGrid, MailChimp, etc.