【緊急!!!】 カニが大安売り!!!!

おすすめ! レンタルサーバ

VPSサーバ 最強!!!!!

Webショップ開くならここかな!

おすすめ!スタンダードなレンタルサーバ

ここもお勧め!費用×仕様 最高!

女の子でも簡単!初心者向けレンタルサーバ

企業向け 堅い&しっかりレンタルサーバ

Recent Comment

Recent Trackback

スポンサーサイト

一定期間更新がないため広告を表示しています

  • 2010.10.20 Wednesday
  • -
  • -
  • -
  • -
  • -
  • by スポンサードリンク

メールサーバの構築(smtp)

まず、デフォルトで動いているsendmailを停止

# /etc/rc.d/init.d/sendmail stop

sendmailを停止中: [ OK ]

sm-clientを停止中: [ OK ]


sendmail自動起動解除

# chkconfig sendmail off


sendmailランレベルの確認(off)

# chkconfig --list sendmail

sendmail 0:off 1:off 2:off 3:off 4:off 5:off 6:off


postfixをインストールする

# yum -y install postfix


設定ファイルの編集

# vi /etc/postfix/main.cf




# INTERNET HOST AND DOMAIN NAMES

#

# The myhostname parameter specifies the internet hostname of this

# mail system. The default is to use the fully-qualified domain name

# from gethostname(). $myhostname is used as a default value for many

# other configuration parameters.

#

#myhostname = host.domain.tld

#myhostname = virtual.domain.tld

myhostname = mail.hoge.jp ・・・ FQDN名を指定



# The mydomain parameter specifies the local internet domain name.

# The default is to use $myhostname minus the first component.

# $mydomain is used as a default value for many other configuration

# parameters.

#

#mydomain = domain.tld

mydomain = hoge.jp ・・・ ドメイン名を指定



# SENDING MAIL

#

# The myorigin parameter specifies the domain that locally-posted

# mail appears to come from. The default is to append $myhostname,

# which is fine for small sites. If you run a domain with multiple

# machines, you should (1) change this to $mydomain and (2) set up

# a domain-wide alias database that aliases each user to

# user@that.users.mailhost.

#

# For the sake of consistency between sender and recipient addresses,

# myorigin also specifies the default domain name that is appended

# to recipient addresses that have no @domain part.

#

#myorigin = $myhostname

myorigin = $mydomain ・・・ 送信元メールアドレスの@以降にドメイン名を付加



# The inet_interfaces parameter specifies the network interface

# addresses that this mail system receives mail on. By default,

# the software claims all active interfaces on the machine. The

# parameter also controls delivery of mail to user@[ip.address].

#

# See also the proxy_interfaces parameter, for network addresses that

# are forwarded to us via a proxy or network address translator.

#

# Note: you need to stop/start Postfix when this parameter changes.

#

inet_interfaces = all ・・・ 外部からのメール受信を許可

#inet_interfaces = $myhostname

#inet_interfaces = $myhostname, localhost

#inet_interfaces = localhost





# The mydestination parameter specifies the list of domains that this# machine considers itself the final destination for.

#

# These domains are routed to the delivery agent specified with the

# local_transport parameter setting. By default, that is the UNIX

# compatible delivery agent that lookups all recipients in /etc/passwd

# and /etc/aliases or their equivalent.

#

# The default is $myhostname + localhost.$mydomain. On a mail domain

# gateway, you should also include $mydomain.

#

# Do not specify the names of virtual domains - those domains are

# specified elsewhere (see VIRTUAL_README).

#

# Do not specify the names of domains that this machine is backup MX

# host for. Specify those names via the relay_domains settings for

# the SMTP server, or use permit_mx_backup if you are lazy (see

# STANDARD_CONFIGURATION_README).

#

# The local machine is always the final destination for mail addressed

# to user@[the.net.work.address] of an interface that the mail system

# receives mail on (see the inet_interfaces parameter).

#

# Specify a list of host or domain names, /file/name or type:table

# patterns, separated by commas and/or whitespace. A /file/name

# pattern is replaced by its contents; a type:table is matched when

# a name matches a lookup key (the right-hand side is ignored).

# Continue long lines by starting the next line with whitespace.

#

# See also below, section "REJECTING MAIL FOR UNKNOWN LOCAL USERS".

#

#mydestination = $myhostname, localhost.$mydomain, localhost

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

 ↑・・・ 自ドメイン宛メールを受信できるようにする

#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,

# mail.$mydomain, www.$mydomain, ftp.$mydomain



# DELIVERY TO MAILBOX

#

# The home_mailbox parameter specifies the optional pathname of a

# mailbox file relative to a user's home directory. The default

# mailbox file is /var/spool/mail/user or /var/mail/user. Specify

# "Maildir/" for qmail-style delivery (the / is required).

#

#home_mailbox = Mailbox

home_mailbox = Maildir/ ・・・ メールボックス形式をMaildir形式にする





# SHOW SOFTWARE VERSION OR NOT

#

# The smtpd_banner parameter specifies the text that follows the 220

# code in the SMTP server's greeting banner. Some people like to see

# the mail version advertised. By default, Postfix shows no version.

#

# You MUST specify $myhostname at the start of the text. That is an

# RFC requirement. Postfix itself does not care.

#

#smtpd_banner = $myhostname ESMTP $mail_name

#smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)

smtpd_banner = $myhostname ESMTP unknown ・・・ smtpバナーの隠匿



以下、最終行に追加する



# SMTP-Auth設定

smtpd_sasl_auth_enable = yes

smtpd_sasl_local_domain = $myhostname

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination



saslauthd起動

# /etc/rc.d/init.d/saslauthd start


saslauthdの自動起動設定

# chkconfig saslauthd on


saslauthdランレベルの確認

# chkconfig --list saslauthd

saslauthd 0:off 1:off 2:on 3:on 4:on 5:on 6:off


新規ユーザ追加時に自動でMaildirが作成されるようにする

# mkdir -p /etc/skel/Maildir/new

# mkdir -p /etc/skel/Maildir/cur

# mkdir -p /etc/skel/Maildir/tmp


属性変更

# chmod -R 700 /etc/skel/Maildir/


メールサーバープログラムの切替え

# alternatives --config mta



2 プログラムがあり 'mta'を提供します。



選択 コマンド

-----------------------------------------------

*+ 1 /usr/sbin/sendmail.sendmail

2 /usr/sbin/sendmail.postfix



Enterを押して現在の選択[+]を保持するか、選択番号を入力します: ・・・2を押す


Postfixを起動

# /etc/rc.d/init.d/postfix start 

Starting postfix: [ OK ]


Postfix自動起動設定

# chkconfig postfix on


Postfixランレベルの確認

# chkconfig --list postfix

postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off

| 1/1PAGES |