Trying to configure sendmail in Debian

Discussion in 'General Linux' started by raphael75, Mar 8, 2013.

  1. raphael75

    raphael75 New Member

    Messages:
    9
    Likes Received:
    2
    Trophy Points:
    3
    I'm trying to configure sendmail on our Debian Linux server to send mail, using our Exchange server as a relay. I'm a total noob at all of this.

    We can send mails to internal addresses (for example, if our domain name is ourdomain.com, the server can send mail to bob@ourdomain.com) with no problem.

    We can't send mail to external addresses like bob@gmail.com or bob@hotmail.com. Here's an example of what I get in /var/log/mail.log

    Mar 7 14:45:29 newton sm-mta[17159]: r27JjOw1017159: to=<user9999@gmail.com>, ctladdr=<root@newton.forrest> (0/0), delay=00:00:05, xdelay=00:00:05, mailer=relay, pri=30455, relay=webmail.ourdomain.ws. [xxx.xxx.xxx.xxx], dsn=5.7.1, stat=User unknown

    Also, I get this:

    Code:
    root@newton:/etc/mail# sendmail -bv user9999@gmail.com
    
    user9999@gmail.com... deliverable: mailer relay, host webmail.ourdomain.ws, user user9999@gmail.com
    Does that mean the user9999@gmail.com is unknown to newton, or unknown to Exchange?


    Is there something in Exchange we need to configure?

    I have no idea what to configure. Please help. Thanks!
  2. McCody

    McCody New Member

    Messages:
    16
    Likes Received:
    5
    Trophy Points:
    0
    for that you need to configure the IMAP and SMTP in the send for that just follow this

    Sendmail is the default MTA on the RedHat Linux distribution. Do NOT use linuxconf to configure sendmail as it has NOT been updated to work with current versions of sendmail!!! (The tool linuxconf is no longer included with current versions of Red Hat Linux 7.3+)

    RPM packages required: sendmail, sendmail-cf and m4

    Ubuntu/Debian install: sudo apt-get sendmail sendmail-base sendmail-bin sendmail-cf mailutils

    Sendmail receives mail for local system user login accounts. Mail is held in a single file: /var/mail/userID

    Steps to run mail server using sendmail:

    Required for inbound mail: The mail server must be identified by the DNS as the mail server in order to receive mail. See the YoLinux web tutorial on configuring DNS.
    /etc/mail/local-host-names (Required) (Red Hat 7.1 - Fedora Core 3)
    /etc/sendmail.cw (Red Hat 6.x)
    This file contains all of the alternate host names of the server. (i.e. domain-name.com) Sendmail will not accept mail for a domain unless it is permitted to do so by the contents of this file.
    Sample:

    megawebhost.com
    yolinux.com
    yo-linux.com

    File /etc/aliases (Optional) lists alternative names for email recipients.
    Sample:
    webmaster: john, dave
    postmaster: kim, garret
    larry.anderson: larry
    moe.anderson: moe
    curly.anderson: curly

    After creation or modification one must run the command newaliases which will generate a new version of the file /etc/aliases.db There is no need to restart the sendmail daemon. The changes are picked up automatically.
    File /etc/mail/virtusertable (Optional) Allows the separation of emails by domain. i.e. greg@domain1.com and greg@domain2.com go to two different users greg1 and greg2.
    webmaster@domain-1.com dave
    webmaster@domain-2.com john
    john@domain-2.com john
    @domain-2.com error:nouser User unknown
    @domain3.com mathew

    The second column is the local user, a remote forwarding email address or a mailing list entry in /etc/aliases.
    The domain "domain-2.com" will only receive email for john@domain-2.com and webmaster@domain-2.com while all other mail to this domain receives an error message.
    Convert /etc/mail/virtusertable to /etc/mail/virtusertable.db with the commands:
    cd /etc/mail
    make
    Relaying and receiving mail is controlled by the file: /etc/mail/access. By default relaying is only allowed by localhost and sendmail will accept mail from all. (Red Hat 7.1 default is more strict but the restriction is not from the access file. More below.)
    Required for outbound email. Helpful for blocking some unwanted inbound email.
    localhost.localdomain RELAY
    localhost RELAY
    127.0.0.1 RELAY

    Generate database file:
    [root prompt]# makemap hash /etc/mail/access.db < /etc/mail/access

    The access file can be used to thwart spammers. List IP addresses or email address to deny in the file: /etc/access
    After adding entries to the access file, generate the database file with the command above.
    XXX.XXX.XXX.XXX REJECT
    YYY.YYY.YYY.YYY ERROR:"550 We don't accept mail from spammers"
    spammer@isp.com REJECT " Spam not accepted"
    ZZZ.ZZZ.ZZZ.ZZZ OK - Override rules and allow
    ZZZ.ZZZ OK - Allow from ZZZ.ZZZ.*.* network

    See the /etc/mail/access file I am currently using. It changes daily. Feel free to cut and paste this Sendmail access file to your system.
    Other access lists:
    Iowa State University
    West-Point.org
    IP block list used by http: Wizcrafts.net: Exploited server list
    Sendmail.org: More info on cf-readme (See Anti-Spam section)
    Sendmail must be running

Share This Page