sendmail-8.11.6-3 (SMTP, POP3, IMAP4)

Support

sendmail - an electronic mail transport agent 

Installation

# rpm -ihv sendmail-8.11.6-3.i386.rpm
# rpm -ihv sendmail-doc-8.11.6-3.i386.rpm
# rpm -ihv sendmail-cf-8.11.6-3.i386.rpm
# rpm -ihv imap-2000c-15.i386.rpm
# rpm -ihv imap-devel-2000c-15.i386.rpm

Location of setting file

Path  
/etc/mail/sendmail.mc  
/etc/mail/access  
/etc/mail/local-host-names  
/etc/mail/relay-domains  

How to make sendmail.cf

  1. Edit /etc/mail/sendmail.mc

    divert(-1)
    dnl This is the sendmail macro config file. If you make changes to this file,
    dnl you need the sendmail-cf rpm installed and then have to generate a
    dnl new /etc/sendmail.cf by running the following command:
    dnl
    dnl        m4 /etc/mail/sendmail.mc > /etc/sendmail.cf
    dnl
    include(`/usr/share/sendmail-cf/m4/cf.m4')
    VERSIONID(`linux setup for Red Hat Linux')dnl
    OSTYPE(`linux')
    define(`confDEF_USER_ID',``8:12'')dnl
    define(`confAUTO_REBUILD')dnl
    define(`confTO_CONNECT', `1m')dnl
    define(`confTRY_NULL_MX_LIST',true)dnl
    define(`confDONT_PROBE_INTERFACES',true)dnl
    define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl
    define(`ALIAS_FILE', `/etc/aliases')dnl
    define(`UUCP_MAILER_MAX', `2000000')dnl
    define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
    define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
    define(`confAUTH_OPTIONS', `A')dnl
    FEATURE(`no_default_msa',`dnl')dnl
    FEATURE(`smrsh',`/usr/sbin/smrsh')dnl
    FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl
    FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable.db')dnl
    FEATURE(redirect)dnl
    FEATURE(always_add_domain)dnl
    FEATURE(use_cw_file)dnl
    FEATURE(use_ct_file)dnl
    FEATURE(local_procmail,`',`procmail -t -Y -a $h -d $u')dnl
    FEATURE(`access_db',`hash -o /etc/mail/access.db')dnl
    FEATURE(`blacklist_recipients')dnl
    EXPOSED_USER(`root')dnl
    DAEMON_OPTIONS(`port=smtp,Addr=202.144.158.205, Name=MTA')
    FEATURE(`accept_unresolvable_domains')dnl
    MAILER(smtp)dnl
    MAILER(procmail)dnl
    Cwlocalhost.localdomain
    MASQUERADE_AS(yourdomain.bt)
    MASQUERADE_DOMAIN(yourdomain.bt)
    FEATURE(masquerade_entire_domain)
    FEATURE(masquerade_envelope)

  2. Edit /etc/mail/access

    # Check the /usr/share/doc/sendmail-8.11.6/README.cf file for a description
    # of the format of this file. (search for access_db in that file)
    # The /usr/share/doc/sendmail-8.11.6/README.cf is part of the sendmail-doc
    # package.
    #
    # by default we allow relaying from localhost...
    # localhost.localdomain         RELAY
    # localhost                     RELAY
    # 127.0.0.1                     RELAY

  3. Edit /etc/mail/relay-domains

    192.168.0.
    202.144.158.

  4. Edit /etc/mail/local-host-names

    # local-host-names - include all aliases for your machine here.
    yourhost.yourdomain.bt

  5. Enable imap, imaps, ipop3, pop3s, sendmail using by ntsysv

    # ntsysv

  6. Compile and restart sendmail

    # m4 /etc/mail/sendmail.mc > /etc/sendmail.cf
    # makemap hash /etc/mail/access.db < /etc/mail/access
    # /etc/init.d/sendmail restart

  7. Check the start-up log

    # tail /var/log/message

    ...
    Jun  6 22:28:45 yourname sendmail: sendmail shutdown succeeded
    Jun  6 22:28:47 yourname sendmail: sendmail startup succeeded

How to test

  1. Test by telnet

    # telnet yourhost.yourdomain.bt 110
    Trying 202.144.158.205...
    Connected to yourhost.yourdomain.bt.
    Escape character is '^]'.
    +OK POP3 yourhost v6.50 server ready
    hoge
    -ERR Unknown command in AUTHORIZATION state
    USER youruser
    +OK User name accepted, password please
    PASS ********
    +OK Mailbox open, 15 messages
    LIST
    1 15086
    2 13874
    3 10065
    4 15055
    5 17742
    6 15442
    7 9176
    8 9052
    9 1471
    10 37106
    11 14620
    12 8343
    13 7457
    14 14941
    15 1418
    .
    QUIT
    +OK Sayonara
    Connection closed by foreign host.

  2. Test sendmail.cf

    # sendmail -bt -f /etc/sendmail.cf
    ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
    Enter <ruleset> <address>
    > 0 youruser
    parse              input: youruser
    Parse0             input: youruser
    Parse0           returns: youruser
    ParseLocal         input: youruser
    ParseLocal       returns: youruser
    Parse1             input: youruser
    Parse1           returns: $# local $: youruser
    parse            returns: $# local $: youruser
    > 0 [email protected]
    parse              input: youruser @ yourdomain . bt
    Parse0             input: youruser @ yourdomain . bt
    Parse0           returns: youruser @ yourdomain . bt
    ParseLocal         input: youruser @ yourdomain . bt
    ParseLocal       returns: youruser @ yourdomain . bt
    Parse1             input: youruser @ yourdomain . bt
    Parse1           returns: $# local $: youruser @ yourdomain . bt
    parse            returns: $# local $: youruser @ yourdomain . bt
    >

Reject SPAM domain

If you want to reject receiving mail (as SPAM) from particular domain, maintain /etc/mail/access
  1. Edit /etc/mail/access

    ...
    erohard.com                            REJECT
    americanbranding.easywinning.com       REJECT
    lists.zoanmail.com                     REJECT
    vmadmin.com                            REJECT

  2. Convert access to access.db

    # makemap hash /etc/mail/access.db < /etc/mail/access

  3. Restart sendmail

    # /etc/init.d/sendmail restart

Remove blacklist message automatically

Remove blacklist message automatically by procmail
  1. Edit $HOME/.procmailrc

    BLACKLIST=$HOME/.blacklist

    :0 h
    *$ ? test -s $BLACKLIST
    * ? (formail -x From: -x Reply-To: -x Sender: -x From | fgrep -iqf $BLACKLIST)
    /dev/null

  2. Make a blacklist $HOME/.blacklist

    [email protected]
    [email protected]
    [email protected]
    [email protected]

Aliases name

  1. Edit /etc/aliases

    ...
    group1: user1, user2, user3, . . .
    ...

  2. Rebuild the data base for the mail aliases file
    Newaliases rebuilds the random access data base for the mail aliases file /etc/aliases. It must be run each time this file is changed in order for the change to take effect.

    # newaliases

Message forwarding

  1. Edit ~/.forward file to forward all messages.

    [email protected]

Back

Copyright © [- SroNey / JohN -]. All rights reserved

Hosted by www.Geocities.ws

1