|
|
| ・Postfix (SMTP(mail) Server / MTA)設定 |
[fedora@fedoracore4 ~]$ su -
[root@fedoracore4 ~]# rpm -qa sendmail sendmailがインストールされているか確認
sendmail 8.13.4 このバージョンのsendmailがインストールされている
[root@fedoracore4 ~]# /etc/init.d/sendmail stop sendmail 停止
[root@fedoracore4 ~]# rpm -e sendmail sendmail アンインストール
[root@fedoracore4 ~]# rpm -qa postfix
postfix-2.2.2-2 インストールされているpostfixのバージョンが表示
もしインストールされていなければ yum -y install postfix で最新のpostfix
をインストールしてください。
[root@fedoracore4 ~]# vi /etc/postfix/main.cf
|
main.cf の内容が表示されたらそのまま /#myhostname と入力して下さい。(#myhostnameを検索)
# The mydomain parameter specifies the local internet domain name.
m gethostname(). $myhostname is used as a default value for many
# other configuration parameters.
#
#myhostname = host.domain.tld
#myhostname = virtual.domain.tld
myhostname = fedoracore4.com
# 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 = fedoracore4.com
# 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
myorigin = $mydomain
# RECEIVING MAIL
# 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.
M
#
# Note: you need to stop/start Postfix when this parameter changes.
#
#inet_interfaces = all
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost
#inet_interfaces = localhost
#でコメントアウト
inet_interfaces = all
コマンドモードへ戻って /mydestination と入力して下さい。(#mydestinationを検索)
# 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,
# mail.$mydomain, www.$mydomain, ftp.$mydomain
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
# REJECTING MAIL FOR UNKNOWN LOCAL USERS
コマンドモードへ戻って /#mynetworks_style と入力して下さい。(#mynetworks_styleを検索)
# Specify "mynetworks_style = host" when Postfix should "trust"
# only the local machine.
#
#mynetworks_style = class
#mynetworks_style = subnet
#mynetworks_style = host #でコメントアウト
mynetworks_style = subnet
# Alternatively, you can specify the mynetworks list by hand, in
# which case Postfix ignores the mynetworks_style setting.
#
# Specify an explicit list of network/netmask patterns, where the
# mask specifies the number of bits in the network part of a host
# address.
#
# You can also specify the absolute pathname of a pattern file instead
# of listing the patterns here. Specify type:table for table-based lookups
# (the value on the table right-hand side is not used).
#
#mynetworks = 168.100.189.0/28, 127.0.0.0/8
#mynetworks = $config_directory/mynetworks
#mynetworks = hash:/etc/postfix/network_table
mynetworks = 192.168.1.0/24, 127.0.0.0/8
コマンドモードへ戻って /#relay_domains と入力して下さい。(#relay_domainsを検索)
# NOTE: Postfix will not automatically forward mail for domains that
# list this system as their primary or backup MX host. See the
# permit_mx_backup restriction description in postconf(5).
#
#relay_domains = $mydestination
relay_domains = $mydestination
# INTERNET OR INTRANET
コマンドモードへ戻って /#home_mailbox と入力して下さい。(#home_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/
home_mailbox = Maildir/
:wq で保存
|
| ・Postfix (SMTP(mail) Server / MTA) 起動・設定確認・起動設定 |
[root@fedoracore4 ~]# /etc/init.d/postfix start postfix起動
postfix を起動中: [ OK ]
[root@fedoracore4 ~]# mail fedora <Enter>で次へ (fedora へメール)
Subject: testmail <Enter>で次へ
root to fedora <Enter>で改行し、<Ctrl>+<D>でCc:へ
Cc: <Ctrl>+<D>で送信
[root@fedoracore4 ~]$ cat /home/fedora/Maildir/new/1120293212.Vfd00I7ff36M800301.fedorac
ore4.com /home/ユーザー名/Maildir/new/ 以降は各環境により異なるので<Tab>をうまく利用して表示させて下さい。
Return-Path: <root@fedoracore4.com>
X-Original-To: fedora
Delivered-To: fedora@fedoracore4.com
To: fedora@fedoracore4.com
Subject: testmail
Message-Id: <20050702083332.B297366F6C9@fedoracore4.com>
Date: Sat, 2 Jul 2005 17:33:32 +0900 (JST)
From: root@fedoracore4.com
root to fedora
ローカル配送テストは無事完了です。
続いて外部のメールサーバーへのテストです。
[root@fedoracore4 ~]# mail username@yahoo.co.jp <Enter>で次へ (username@yahoo.co.jp へメール)
Subject: testmail <Enter>で次へ
root to username@yahoo.co.jp <Enter>で改行し、<Ctrl>+<D>でCc:へ
Cc: <Ctrl>+<D>で送信
ルーター使用環境下では25番ポートを忘れずに解放して下さい。
うまくいかなければ一度ルーターをはずしたり、一時的にポートを解放するなどして原因の切り分けをして下さい。
またこのテストに携帯のメールアドレスを指定しないようにして下さい。 AUなどはうまく受信してくれず、原因の切り分けが難しくなってしまいます。
またこのテストおわかり頂けるように、SMTPサーバーはメールを送信することもできますし、受信することもできるサーバーです。
一般的に言われているpopサーバーが受信するサーバーというのは誤りです。
受信したメールを取り出すサーバー(プロトコル)です。
[root@fedoracore4 ~]# cat chkcofig_def.txt |grep postfix postfixの起動設定確認
[root@fedoracore4 ~]# chkconfig --list postfix 出ないので現在の状態を確認
postfix 0:off 1:off 2:off 3:off 4:off 5:off 6:off 自動起動しない
[root@fedoracore4 ~]# chkconfig postfix on postfix自動起動設定
[root@fedoracore4 ~]# chkconfig --list postfix postfixの起動設定確認
postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off
|
[root@fedoracore4 ~]# vi /etc/aliases
aliases の内容が表示されたらそのまま <Shift> + <g> で行末に移動
www: webmaster
webmaster: root
noc: root
security: root
hostmaster: root
info: postmaster
marketing: postmaster
sales: postmaster
support: postmaster
# trap decode to catch security attacks
decode: root
# Person who should get root's mail
#root: marc
root: fedora root 宛てに届いたメールは fedora に転送
:wq で保存
[root@fedoracore4 ~]# newaliases 設定を有効化
[root@fedoracore4 ~]# exit fedoraに戻る
[fedora@fedoracore4 ~]# mail root <Enter>で次へ (root へメール)
Subject: testmail <Enter>で次へ
fedora to root <Enter>で改行し、<Ctrl>+<D>でCc:へ
Cc: <Ctrl>+<D>で送信
[root@fedoracore4 ~]# ls -all /home/fedora/Maildir/new/ 新着メールの確認
合計 2
drwx------ 2 fedora fedora 4096 7月 2 17:40 .
drwx------ 5 fedora fedora 4096 6月 30 14:45 ..
-rw------- 1 fedora fedora 288 7月 2 17:33 1120293212.Vfd00I7ff36M800301.fedoracore4.com
-rw------- 1 fedora fedora 275 7月 2 17:40 1120293601.Vfd00I7ff37M737792.fedoracore4.com 新着
[root@fedoracore4 ~]# cat /home/fedora/Maildir/new/1120293601.Vfd00I7ff37M737792.fedoracore4.com
Return-Path: <fedora@fedoracore4.com>
X-Original-To: root
Delivered-To: root@fedoracore4.com
To: root@fedoracore4.com
Subject: testmail
Message-Id: <20050702084001.9D9A766F6C9@fedoracore4.com>
Date: Tue, 2 Jul 2005 17:40:01 +0900 (JST)
From: fedora@fedoracore4.com
fedora to root
[root@fedoracore4 ~]# root 宛てのメールは fedora に転送されることを確認 |
dovecot設定へ
|