Operating System - HP-UX
1861553 Members
2328 Online
110428 Solutions
New Discussion

Re: Sendmail - controlling OUTGOING mail

 
Bill Richardson_3
Occasional Contributor

Sendmail - controlling OUTGOING mail

How can I control OUTGOING mail via sendmail?
I have a test machine and ONLY want mail address to [email protected] to make it out of my
system. ANY other mail should be rejected. Can I create a list of good email addresses [email protected], [email protected], etc. and reject ALL other OUTGOING? Do I do this through the access.db?
Thanks,
Bill
5 REPLIES 5
Steven E. Protter
Exalted Contributor

Re: Sendmail - controlling OUTGOING mail

You may need to use sendmail.cf

You should be able to do it with access and the aliases file

aliases

@hostname: [email protected]


tab delimited as you already know.

Add your lists to aliases

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Kasper Haitsma
Trusted Contributor

Re: Sendmail - controlling OUTGOING mail

Hi Bill,

As almost most of the time, SEP is right.
Although I think you only need access_db. For layout of access_db, check:

on (RH)linux /usr/share/doc/sendmail*/README.cf and search for access_db
on hp-ux /usr/newconfig/etc/mail/cf/README when you've installed a regular patch for sendmail (PHNE_...)
/usr/contrib/sendmail/usr/newconfig/etc/mail/cf/README if you have installed a web upgrade to sendmail 8.11

HTH

Kasper Haitsma
HP support engineer for sendmail, OpenMail OVO/u
It depends
Berlene Herren
Honored Contributor

Re: Sendmail - controlling OUTGOING mail

Hi Bill,
Take a look at option 8 with gen_cf...

This feature enables sendmail to block incoming mail
messages destined for certain recipient usernames,
hostnames, or addresses. This feature also restricts you
from sending mail messages to addresses with an error
message or REJECT value in the Access Database file.

For example, if you have the following entries in the Access
Database file:

badlocaluser 550 Mailbox disabled for this username
host.mydomain.com 550 That host does not accept mail
[email protected] 550 Mailbox disabled for this recipient

This would prevent a recipient of [email protected],
any user at host.mydomain.com, and the single address
[email protected] from receiving mail.

[email protected] REJECT

cyberspammer.com REJECT

Mail can't be sent to [email protected] or anyone at cyberspammer.com.

Berlene
http://www.mindspring.com/~bkherren/dobes/index.htm
Bill Richardson_3
Occasional Contributor

Re: Sendmail - controlling OUTGOING mail

Berlene,

This is so close! But ... I want to restrict EVERY outgoing mail except to one user. So would the sytax in the access file be something like ...

.com REJECT
[email protected] RELAY

Thanks,
Bill
Berlene Herren
Honored Contributor

Re: Sendmail - controlling OUTGOING mail

Well, we know you can rewrite sendmail rules to just about do anything... here is a hack I found restricts all email bound for the internet, perhaps you could start with that? I cannot think of a way to it otherwise.

[email protected] RELAY I don't think this would work...



############################################################
############################################################
#####
##### RULESET 0
#####
############################################################
############################################################

S0

# special cases
#
R@ $#local $:$n handle <> form
R$*<@[$+]>$* $#smtp $@[$2] $:$1<@[$2]>$3 numeric
internet spec

# localize if possible (rip off @DOMAINs for which we are
authoritative)
R$*<@$+>$* $:$>8$1<@$2>$3
#

# Fake hosts in my domain
#
R$+<@IMAP> $#imap $@$j $:$1 username@IMAP

# Real hosts in my domain
#
R$*<@$*$N>$* $#smtpl [email protected] $:$1<@$2$N>$3 our
domain; gw

# Parent domain
#
R$*<@$*$P>$* $#smtp [email protected] $:$1<@$2$P>$3 our
domain; gw

# Nonlocal mail
#
# R$*<@$+>$* $#smtp [email protected] $:$1<@$2>$3 use
gateway
R$*<@$+>$* $#error $: Internet Mail Restricted trash
nonlocal mail

# Local mail
#

R$+ $#local $:$1 must be local

############################################################
############################################################

Berlene
http://www.mindspring.com/~bkherren/dobes/index.htm