[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to fake from address in an email



"Leen Besselink" <leen@wirehub.nl> writes:
> > We need to send out an email response from a CGI when someone places an
> > order, but we want to set the from address to something other than the
> > user/machine where the CGI is running. How to do this with the various
> > email packages? Currently using exim, but may switch to postfix or
> > sendmail.
> 
> I think you need something like trusted user/hosts (localhost ?) and or
> relaying (but don't allow relaying for every1 !).
> 
> Just look it up (the ways this is achieved in the packages can be very
> different so).

If they're using exim it's just a matter of adding a an appropriate
rewrite rule, no need to worry about relaying or anything like that. I
think that when you install exim there's even a nice setup for you
already in /etc/exim.conf, you just need to uncomment it and add the
alias to /etc/email-addresses. For example, at the end of my
/etc/exim.conf file I have:

*@hennigan.bogus        ${lookup{$1}lsearch{/etc/email-addresses}\
                                                {$value}fail} bcfrF

The file /etc/email-addresses has the following line it:

glhenni: glhenni@sandia.gov

The domain of my little LAN at home is hennigan.bogus so any email I
send out would, for example, have "glhenni@hennigan.bogus" as the
address if I didn't do something with it. Obviously there aren't a
whole lot of DNS servers (only one in fact, my own) that can resolve
hennigan.bogus. So exim takes the * --> glhenni and looks in
/etc/email-addresses for "glhenni" it finds "glhenni@sandia.gov" and
replaces all occurences of "glhenni@hennigan.bogus" with
"glhenni@sandia.gov" and sends the email out.

I used to know how to read that little Exim rewrite rule, but that
knowledge has gone the way of the dinosaur. You'll have to read the
Exim manual if you're interested in the details.

As for sendmail and postfix I'm sure they both have a similar
mechanism, but I'm not familiar with either of them. RTFM for sendmail
and postfix and look what they use for rewrite rules.

Gary



Reply to: