Aaron W. Hsu wrote:
Hey there,

I think I understand your (worked around) problem...

        From [EMAIL PROTECTED] Sat Aug 23 14:49:55 2008
        Subject: Re: From address when using mail command

        Actually this was not my problem. My server is mail and web host
        for several small sites.  I will say that the link below would
        have been really great to have when I was setting up sendmail.
        I really struggled to find any site with a complete, yet simple
        explanation of how to get things going.  m4 works quite easily
        once you know how, but I really had to browse for hours to get
        the simple answer how to use it.

        Richard Toohey sent me a message suggesting an obvious answer I
        should have thought of, since I use it in cgi scripts anyway.
        Just to use sendmail directly, since mail is really just an
        incomplete way of accessing sendmail.

I would call this more of a workaround than a solution, though it could solve the problem perfectly well for you. For me, there are actually feature in mail(1) that I use which would make sendmail inconvenient for me. If the server you are using really does service mail, then things are even easier to work with. If I understand your situation, you are saying that your local hostname is different than the main domain for which the server receives and relays mail. Generally, this is easy to work by a simple MASQUERADING setting. If you know that all mail (except local) that you want to send out should come from the main domain (whose MX records presumably point to the hostname of your server) then you just have to setup up a few MASQUERADING statements in your mc file, maybe do some settings like local_no_masquerade and you are set. Then you should be able to use just about any mail client that relies on sendmail in any similar fashion as does mail(1).
I tried this two different ways,
First I tried masquerade entire domain, but this failed to make mail work correctly but also did change the from addresses incorrectly from other virtual domains I host. (Inow know how to fix this but still doesn't change mail from problem)
Now I've got the following .mc file:

divert(0)dnl
VERSIONID(`@(#)openbsd-proto.mc $Revision: 1.11 $')dnl
OSTYPE(openbsd)dnl
define(`confPRIVACY_FLAGS',
`authwarnings,needmailhelo,noexpn,novrfy,nobodyreturn')dnl
define(`confCW_FILE', `-o MAIL_SETTINGS_DIR`'local-host-names')dnl
define(`confCT_FILE', `-o MAIL_SETTINGS_DIR`'trusted-users')dnl
FEATURE(nouucp, `reject')dnl
FEATURE(`access_db', `hash -o -T<TMPF> /etc/mail/access')dnl
FEATURE(`blacklist_recipients')dnl
FEATURE(`use_cw_file')dnl
FEATURE(`mailertable', `hash -o /etc/mail/mailertable')dnl
FEATURE(`use_ct_file')dnl
FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable')dnl
FEATURE(genericstable, `hash -o /etc/mail/genericstable')dnl
FEATURE(always_add_domain)dnl
FEATURE(redirect)dnl
FEATURE(`no_default_msa')dnl
DAEMON_OPTIONS(`Family=inet, Address=0.0.0.0, Name=MTA')dnl
DAEMON_OPTIONS(`Family=inet6, Address=::, Name=MTA6, M=O')dnl
DAEMON_OPTIONS(`Family=inet, Address=0.0.0.0, Port=587, Name=MSA,
M=E')dnl
DAEMON_OPTIONS(`Family=inet6, Address=::, Port=587, Name=MSA6, M=O,
M=E')dnl
CLIENT_OPTIONS(`Family=inet, Address=0.0.0.0')dnl
CLIENT_OPTIONS(`Family=inet6, Address=::')dnl
define(`confBIND_OPTS', `WorkAroundBrokenAAAA')dnl
define(`CERT_DIR', `MAIL_SETTINGS_DIR`'certs')dnl
define(`confCACERT_PATH', `CERT_DIR')dnl
define(`confCACERT', `CERT_DIR/mycert.pem')dnl
define(`confSERVER_CERT', `CERT_DIR/mycert.pem')dnl
define(`confSERVER_KEY', `CERT_DIR/mykey.pem')dnl
define(`confCLIENT_CERT', `CERT_DIR/mycert.pem')dnl
define(`confCLIENT_KEY', `CERT_DIR/mykey.pem')dnl
MASQUERADE_AS(`bennettconstruction.us')dnl
MASQUERADE_DOMAIN(b03s15le.corenetworks.net bennettconstruction.us)
MASQUERADE_EXCEPTION(`bennettconstruction.us')dnl
MASQUERADE_EXCEPTION(`visionsbykarl.com')dnl
MASQUERADE_EXCEPTION(`ledgersmb.info')dnl
MASQUERADE_EXCEPTION(`edbennett.us')dnl
MASQUERADE_EXCEPTION(`san-isidro-farm.com')dnl
MASQUERADE_EXCEPTION(`bennettconstruction.biz')dnl
FEATURE(limited_masquerade)dnl
MAILER(local)dnl
MAILER(smtp)dnl
LOCAL_RULESETS
HMessage-Id: $>CheckMessageId

SCheckMessageId
R< $+ @ $+ >            $@ OK
R$*                     $#error $: 553 Header Error

This works fine except for mail from problem

I don't send much mail from command line, so the direct use of sendmail seems like an OK compromise for me.
I usually send mail through a cgi or email desktop client from home/office.
Occasionally, I need to send a message real quick from somewhere like public access point and spamdb gets in the way of receiving email message with link to use AP. using ssh during the brief time access is allowed solves problem.

Chris
I think this is probably the more robust solution, but you're free to do it with raw sendmail if you life, which is actually a solution much the same way that the GUI mail clients do (they pipe in the full headers to sendmail and give the user the option to change the From address).

        Aaron

Reply via email to