suse配置sendmail

來源:互聯網
上載者:User

原文地址:http://blog.csdn.net/njhwwgc/article/details/5719602

 

具體步驟如下:
1、使用rpm命令是否有安裝Sendmail軟體
suining:~ # rpm -qa|grep sendmail
sendmail-devel-8.12.10-162.1
sendmail-8.12.10-162.1
suining:~ #
若如上,則已經安裝,若沒有資訊出來,則使用YAST來進行安裝,期間會提示插入相應安裝盤

2、我這裡已經安裝,接下來
  使用rpm命令確認安裝了imap
suining:~ # rpm -qa|grep imap
php4-imap-4.3.4-43.8
imap-lib-2002e-92.1
imap-2002e-92.1
imap-devel-2002e-92.1
若如上,則已經安裝,若沒有資訊出來,則使用YAST來進行安裝,期間會提示插入相應安裝盤
  使用rpm命令確認安裝了pop
suining:/etc/xinetd.d # rpm -qa|grep pop
popt-1.7-176.7
qpopper-4.0.5-175.1
若如上,則已經安裝,若沒有資訊出來,則使用YAST來進行安裝,期間會提示插入相應安裝盤

3、修改/etc/sysconfig/mail這個設定檔,是本機以外的人可以使用該伺服器EMAIL,如下:
suining:/etc/sysconfig # more mail
## Path:                Network/Mail/General
## Description:
## Type:        string
## Default:     ""
## Config:      postfix
## ServiceReload:       sendmail,postfix
#
# From:-Line in email and News postings
# (otherwise the FQDN is used)
#
FROM_HEADER=""
## Path:        Network/Mail/General
## Description: General configuration of mail interface
## Type:        yesno
## Default:     yes
## Config:      sendmail,postfix
#
# If you don't want to let SuSEconfig generate your
# configuration file, set this to no
#
MAIL_CREATE_CONFIG="yes"

## Type:        yesno
## Default:     no
## Config:      postfix
#
# Set this to "yes" if mail from remote should be accepted
# this is necessary for any mail server.
# If set to "no" or empty then only mail from localhost
# will be accepted.
#
SMTPD_LISTEN_REMOTE="yes"  ----原來是no,一定要改成yes才能讓其它外部PC使用該EMIAL伺服器發郵件

4、修改Linux.mc設定檔,編輯/etc/mail/Linux.mc檔案
在83%處將:
dnl FEATURE(`authinfo',                 `hash -o 'AUTH_DIR`/auth-info')dnl
修改為:
FEATURE(`access_db',                    `hash -T<TMPF> -o /etc/mail/access.db')d
nl
在86%處將:
dnl TRUST_AUTH_MECH(`place_here_your_auth_mechanism')dnl
dnl define(`confAUTH_MECHANISMS',       `place_here_your_auth_mechanism')dnl
修改為:
TRUST_AUTH_MECH(`place_here_your_auth_mechanism')dnl
define(`confAUTH_MECHANISMS',   `place_here_your_auth_mechanism')dnl

然後:
suining:/etc/mail # m4 /etc/mail/linux.mc > /etc/sendmail.cf
產生可用的sendmail.cf

5、編輯/etc/sendmail.cf檔案,如下
在13%處,將:
# SMTP client options
#O ClientPortOptions=Family=inet, Address=0.0.0.0
修改為:
# SMTP client options
O ClientPortOptions=Family=inet, Address=10.38.223.195   ---原生IP

6、編輯/etc/mail/local-host-names,加入本機網域名稱
# Format:
#
#<aliases for local host>

mail.sina.com
sina.com

7、編輯/etc/mail/access,加入
# Default for loop back is RELAY
127             RELAY
10.38.223       RELAY
允許10.38.223位址區段的郵件轉寄
然後:
suining:/etc/mail # makemap hash /etc/mail/access.db < /etc/mail/access
將access裡的檔案內容轉化為/etc/mail/access.db資料庫

8、suining:/etc/mail # chkconfig --level 35 sendmail on
   suining:/etc/mail #
運行3,5層級下讓sendmail服務開機自動載入

9、查看/etc/services,確保:
smtp             25/tcp    mail         # Simple Mail Transfer
smtp             25/udp    mail         # Simple Mail Transfer

pop3            110/tcp    # Post Office Protocol - Version 3
pop3            110/udp    # Post Office Protocol - Version 3
前的#號沒有被注釋掉

10、編輯/etc/xinetd.d下的imap檔案,修改如下:

# imap - imap mail daemon
#
service imap
{
        disable         = yes          ---------修改為no
        socket_type     = stream
        protocol        = tcp
        wait            = no
        user            = root
        server          = /usr/sbin/imapd
        flags           = IPv4
}
        編輯/etc/xinetd.d下的qpopper檔案,修改如下:
# qpopper - pop3 mail daemon
#
service pop3
{
        disable         = yes          ----------修改為no
        socket_type     = stream
        protocol        = tcp
        wait            = no
        user            = root
        server          = /usr/sbin/popper
        server_args     = -s
        flags           = IPv4
}
~

接著重新啟動xinetd
suining:/etc/init.d # ./xinetd restart
Shutting down xinetd:                                                done
Starting INET services. (xinetd)                                     done
suining:/etc/init.d #

使用如下命令查看狀態
suining:/usr/sbin # ./ipop3d status
+OK POP3 suining.js v2003.83 server ready

suining:/usr/sbin # ./imapd status
* OK [CAPABILITY IMAP4REV1 LOGIN-REFERRALS STARTTLS LOGINDISABLED] suining.js IMAP4rev1 2003.339 at Sun, 6 Jul 2008 14:30:06 -0700 (PDT)

11、最後重新啟動Sendmail服務

suining:/etc/init.d # ./sendmail start
Initializing SMTP port (sendmail)                                    done
suining:/etc/init.d #

12、先本機測試:
suining:~ # telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 suining.js ESMTP Sendmail 8.12.10/8.12.10/SuSE Linux 0.7; Sun, 6 Jul 2008 14:41:47 -0700
ehlo aa
250-suining.js Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
quit
221 2.0.0 suining.js closing connection
Connection closed by foreign host.
說明服務成功啟動,並且本機可以使用

suining:~ # telnet 10.38.223.195 25
Trying 10.38.223.195...
Connected to 10.38.223.195.
Escape character is '^]'.
220 suining.js ESMTP Sendmail 8.12.10/8.12.10/SuSE Linux 0.7; Sun, 6 Jul 2008 14:42:35 -0700
ehlo bb
250-suining.js Hello suining.js [10.38.223.195], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
quit
221 2.0.0 suining.js closing connection
Connection closed by foreign host.

說明其它PC可以通過該IP來使用EMAIL服務

suining:~ # telnet mail.sina.com 25
Trying 10.38.223.195...
Connected to mail.sina.com.
Escape character is '^]'.
220 suining.js ESMTP Sendmail 8.12.10/8.12.10/SuSE Linux 0.7; Sun, 6 Jul 2008 14:43:41 -0700
ehlo cc
250-suining.js Hello suining.js [10.38.223.195], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
quit
221 2.0.0 suining.js closing connection
Connection closed by foreign host.
說明可以通過網域名稱來使用

然後可以建立使用者,使用WINDOWS的outlook用戶端來做測試。

記住:一定要在/etc/hosts裡添加類似如下行
192.168.1.106   study.zzjtlxs.com study

原文地址:http://blog.csdn.net/njhwwgc/article/details/5719602

 

具體步驟如下:
1、使用rpm命令是否有安裝Sendmail軟體
suining:~ # rpm -qa|grep sendmail
sendmail-devel-8.12.10-162.1
sendmail-8.12.10-162.1
suining:~ #
若如上,則已經安裝,若沒有資訊出來,則使用YAST來進行安裝,期間會提示插入相應安裝盤

2、我這裡已經安裝,接下來
  使用rpm命令確認安裝了imap
suining:~ # rpm -qa|grep imap
php4-imap-4.3.4-43.8
imap-lib-2002e-92.1
imap-2002e-92.1
imap-devel-2002e-92.1
若如上,則已經安裝,若沒有資訊出來,則使用YAST來進行安裝,期間會提示插入相應安裝盤
  使用rpm命令確認安裝了pop
suining:/etc/xinetd.d # rpm -qa|grep pop
popt-1.7-176.7
qpopper-4.0.5-175.1
若如上,則已經安裝,若沒有資訊出來,則使用YAST來進行安裝,期間會提示插入相應安裝盤

3、修改/etc/sysconfig/mail這個設定檔,是本機以外的人可以使用該伺服器EMAIL,如下:
suining:/etc/sysconfig # more mail
## Path:                Network/Mail/General
## Description:
## Type:        string
## Default:     ""
## Config:      postfix
## ServiceReload:       sendmail,postfix
#
# From:-Line in email and News postings
# (otherwise the FQDN is used)
#
FROM_HEADER=""
## Path:        Network/Mail/General
## Description: General configuration of mail interface
## Type:        yesno
## Default:     yes
## Config:      sendmail,postfix
#
# If you don't want to let SuSEconfig generate your
# configuration file, set this to no
#
MAIL_CREATE_CONFIG="yes"

## Type:        yesno
## Default:     no
## Config:      postfix
#
# Set this to "yes" if mail from remote should be accepted
# this is necessary for any mail server.
# If set to "no" or empty then only mail from localhost
# will be accepted.
#
SMTPD_LISTEN_REMOTE="yes"  ----原來是no,一定要改成yes才能讓其它外部PC使用該EMIAL伺服器發郵件

4、修改Linux.mc設定檔,編輯/etc/mail/Linux.mc檔案
在83%處將:
dnl FEATURE(`authinfo',                 `hash -o 'AUTH_DIR`/auth-info')dnl
修改為:
FEATURE(`access_db',                    `hash -T<TMPF> -o /etc/mail/access.db')d
nl
在86%處將:
dnl TRUST_AUTH_MECH(`place_here_your_auth_mechanism')dnl
dnl define(`confAUTH_MECHANISMS',       `place_here_your_auth_mechanism')dnl
修改為:
TRUST_AUTH_MECH(`place_here_your_auth_mechanism')dnl
define(`confAUTH_MECHANISMS',   `place_here_your_auth_mechanism')dnl

然後:
suining:/etc/mail # m4 /etc/mail/linux.mc > /etc/sendmail.cf
產生可用的sendmail.cf

5、編輯/etc/sendmail.cf檔案,如下
在13%處,將:
# SMTP client options
#O ClientPortOptions=Family=inet, Address=0.0.0.0
修改為:
# SMTP client options
O ClientPortOptions=Family=inet, Address=10.38.223.195   ---原生IP

6、編輯/etc/mail/local-host-names,加入本機網域名稱
# Format:
#
#<aliases for local host>

mail.sina.com
sina.com

7、編輯/etc/mail/access,加入
# Default for loop back is RELAY
127             RELAY
10.38.223       RELAY
允許10.38.223位址區段的郵件轉寄
然後:
suining:/etc/mail # makemap hash /etc/mail/access.db < /etc/mail/access
將access裡的檔案內容轉化為/etc/mail/access.db資料庫

8、suining:/etc/mail # chkconfig --level 35 sendmail on
   suining:/etc/mail #
運行3,5層級下讓sendmail服務開機自動載入

9、查看/etc/services,確保:
smtp             25/tcp    mail         # Simple Mail Transfer
smtp             25/udp    mail         # Simple Mail Transfer

pop3            110/tcp    # Post Office Protocol - Version 3
pop3            110/udp    # Post Office Protocol - Version 3
前的#號沒有被注釋掉

10、編輯/etc/xinetd.d下的imap檔案,修改如下:

# imap - imap mail daemon
#
service imap
{
        disable         = yes          ---------修改為no
        socket_type     = stream
        protocol        = tcp
        wait            = no
        user            = root
        server          = /usr/sbin/imapd
        flags           = IPv4
}
        編輯/etc/xinetd.d下的qpopper檔案,修改如下:
# qpopper - pop3 mail daemon
#
service pop3
{
        disable         = yes          ----------修改為no
        socket_type     = stream
        protocol        = tcp
        wait            = no
        user            = root
        server          = /usr/sbin/popper
        server_args     = -s
        flags           = IPv4
}
~

接著重新啟動xinetd
suining:/etc/init.d # ./xinetd restart
Shutting down xinetd:                                                done
Starting INET services. (xinetd)                                     done
suining:/etc/init.d #

使用如下命令查看狀態
suining:/usr/sbin # ./ipop3d status
+OK POP3 suining.js v2003.83 server ready

suining:/usr/sbin # ./imapd status
* OK [CAPABILITY IMAP4REV1 LOGIN-REFERRALS STARTTLS LOGINDISABLED] suining.js IMAP4rev1 2003.339 at Sun, 6 Jul 2008 14:30:06 -0700 (PDT)

11、最後重新啟動Sendmail服務

suining:/etc/init.d # ./sendmail start
Initializing SMTP port (sendmail)                                    done
suining:/etc/init.d #

12、先本機測試:
suining:~ # telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 suining.js ESMTP Sendmail 8.12.10/8.12.10/SuSE Linux 0.7; Sun, 6 Jul 2008 14:41:47 -0700
ehlo aa
250-suining.js Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
quit
221 2.0.0 suining.js closing connection
Connection closed by foreign host.
說明服務成功啟動,並且本機可以使用

suining:~ # telnet 10.38.223.195 25
Trying 10.38.223.195...
Connected to 10.38.223.195.
Escape character is '^]'.
220 suining.js ESMTP Sendmail 8.12.10/8.12.10/SuSE Linux 0.7; Sun, 6 Jul 2008 14:42:35 -0700
ehlo bb
250-suining.js Hello suining.js [10.38.223.195], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
quit
221 2.0.0 suining.js closing connection
Connection closed by foreign host.

說明其它PC可以通過該IP來使用EMAIL服務

suining:~ # telnet mail.sina.com 25
Trying 10.38.223.195...
Connected to mail.sina.com.
Escape character is '^]'.
220 suining.js ESMTP Sendmail 8.12.10/8.12.10/SuSE Linux 0.7; Sun, 6 Jul 2008 14:43:41 -0700
ehlo cc
250-suining.js Hello suining.js [10.38.223.195], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
quit
221 2.0.0 suining.js closing connection
Connection closed by foreign host.
說明可以通過網域名稱來使用

然後可以建立使用者,使用WINDOWS的outlook用戶端來做測試。

記住:一定要在/etc/hosts裡添加類似如下行
192.168.1.106   study.zzjtlxs.com study

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.