I found this excellent post on misc@, and recommend that those
with the very common problems described in it note it well.
Mr Hsu has done a very good job of answering.
I forward it here with his permission.
Dave
---------- Forwarded message ----------
Date: Thu, 21 Aug 2008 21:48:42 -0500 (CDT)
From: Aaron W. Hsu <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: From address when using mail command
Hello Chris,
From [EMAIL PROTECTED] Thu Aug 21 21:28:29 2008
From: Chris Bennett <[EMAIL PROTECTED]>
Subject: From address when using mail command
Everything with my sendmail and dovecot works great.
But when I occasionally want to send a message using mail command,
The From: address ends up as: [EMAIL PROTECTED]
This is not a good address that someone can reply to.
Sendmail is doing what it is supposed to here. It is sending out mail
from your machine (b03ls15le.corenetworks.net) which are from "user."
Where does mail obtain the From address?
Sendmail is attempting to send out mail from your machine, and it uses
the information of your machine to identify itself. Moreover, since you
are sending from account "user," sendmail is also identifying your
username as the user of the machine sending this mail.
Reading man pages about /etc/myname file doesn't really make it clear
(to me) what other contents it can have.
You should leave those contents the same.
Can I change it to my main server's address and not have a problem?
Would this fix the mail From problem?
If you did a search on this, you probably would have found out a lot more
about what sendmail does and how it works. You also would have discovered
some common solutions to this common misunderstanding.
The reason this problem does not manifest itself when you are using other
clients is probably because they either use their own smtp client to
send mail to a SMART HOST, or they are changing the From header of your
messages to reflect the settings of that client. Mail does not do that,
but rather feeds a more spartan message to sendmail, which then inserts
the relevant headers that it can derive from its configuration.
I believe what you are trying to do is send mail from your machine, where
your machine is not the main mail machine. In other words, another machine
is the hosting mail server (not the exactly correct term). Chances are
you are on a network which is not configured with an IP address which is
likely to avoid the large Dynamic blacklists that many ISPs place on
senders, so you don't even want to use your machine as the primary mail
server.
What you do want to do is use sendmail as a client to relay its non-local
messages to another server which is your main mail server. Usually this
server is provided by your ISP (whether your network or mail provider).
The steps for this are:
1) Configure a SMART_HOST
2) [Possibly] configure authentication
3) [Possibly] configure username rewriting
(2) is necessary if your SMTP server which you use to relay your mail
from your machine to the rest of the world requires some kind of
authentication. This is usually the case if you are using a mail provider
that is different than your network provider, or if you have a
separate SMART HOST outside of your network provider's mail server.
(3) is required if you are going to be using a different username than
the one that you are currently using. The method you choose to do this
may depend on whether you need to rewrite just the username, the domain
only, or both the username and the domain of the sender address.
If you just need to change the domain, then usinge MASQUERADING will
get the job done. If you are just doing username rewriting (you are not
just doing this) you can get by with some other things. If you are doing
both, then you will probably want either a combination of both
MASQUERADING and GENERICS TABLES.
GENERICS TABLES will allow you to map your local username to an external
address. MASQUERADING will just change the domain name sendmail uses
when sending out mail. There are many other options you will want to
investigate.
All of this must be done by choosing the right sendmail ".mc" configuration
file, editing it appropriately, compiling it through m4 and placing it
as directed into the correct location, restarting sendmail, and some
possible (likely) other work. The instructions for conducting such
interesting surgery on your system (it's more like putting on a little
make-up than anything really serious) can be found in rather good
detail in the op.txt manual for sendmail, and the configuration
README in /usr/share/sendmail.
In addition to this, you may be interested in a tutorial I wrote some
time ago on this topic, which can be found at
<http://www.sacrideo.us/Sacrificum_Deo/Stuff_files/sendmail_openbsd.txt>
I hope this helps a little! As I mentioned, the rest is online.
Aaron
_______________________________________________
Openbsd-newbies mailing list
[email protected]
http://mailman.theapt.org/listinfo/openbsd-newbies