When I asked this question, I got one very useful response - mail(1) uses your preferred mail backend (default sendmail, also postfix etc.) to send the message.
The problem is that most mail servers require that the sending machine's stated hostname is valid, resolves to the hosts IP address, and (in many cases) agrees with the reverse lookup. A dial up user, and a system in a private network, fulfills none of these requirements.
However, your ISP is running a mail server that does. So you have to use that one. And doing this is simple. It requires two functions - MASQUERADE_AS to hide your invalid local domain name, and SMART_HOST to direct it to use their mail server. "masquerade envelope" and "accept unresolvable domains" also help things along.
I used to think that sendmail was a nightmare to configure. Well, maybe I'm wrong, but the current system seemed dead easy to me. So here we go -
In this example, I have used the following information. Replace it with yours wherever it appears.
ISP's domain name yourisp.net
ISP's mail server smtp.yourisp.net
Your machine's hostname hostname
Local domain domain.local
1. # cd /etc/mail
2. # cp freebsd.mc hostname.domain.local.mc
3. edit hostname.domain.local.mc to include the following lines. (For more information, check out the README file indicated in the first few lines of that file)
Code:
define(`SMART_HOST', `smtp.yourisp.net')
MASQUERADE_AS(`yourisp.net')
FEATURE(`masquerade_envelope')
FEATURE(`accept_unresolvable_domains')
these lines:
1.Tell sendmail to always send mail through you isp's mail server
2.Use your isp's domain name when sending email
3.Use that name in most places
4.Accept emails even if DNS is failing at the moment. (say, if you are not connected yet)
4. # make install restart (that should `compile' the config file into the .cf file, copy it to sendmail.cf, and restart sendmail)