|
[ qmail ] メール送信テスト †ローカル配送テスト †[user@linux ~]$ echo to: root@host.example.jp | /var/qmail/bin/qmail-inject ローカル配送テスト(mailコマンド) †[user@linux ~]$ mail -s "[タイトル]" [宛先(To)] -- -f [差出人(from)] << EOF [Enter] 本文入力 [Enter] EOF [Enter] ※ 例1 [user@linux ~]$ mail -s "test" example@example.jp -- -f example@example.jp << EOS [Enter] test [Enter] EOS [Enter] ※ 例2 [user@linux ~]$ mail -s `"題名" | nkf -j` example@example.jp test . Cc: copy@example.jp(空白でも可) ※ 例3 [user@linux ~]$ mail -s `echo "てすと" | nkf -j` info@example.jp <<EOF > `echo "てすと" | nkf -j` > > EOF [user@linux ~]$ telnet で送信 †telnet localhost 587 Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. 220 127.0.0.1 ESMTP HELO ←■ 入力 [Enter] 250 example.jp MAIL FROM: from@example.jp ←■ 送信元メールアドレス [Enter] 250 ok RCPT TO: to@example.jp ←■ 送信先メールアドレス [Enter] 250 ok DATA ←■ DATA 入力 [Enter] 354 go ahea From: from@example.jp ←■ 送信元のメールアドレス [Enter] To: to@example.jp ←■ 送信先メールアドレス [Enter] Subjet: test ←■ 入力 [Enter] [Return] Hello World ←■ 入力 [Enter] . ←■ 入力 [Enter] 250 ok 1204611114 qp 27421 QUIT ←■ 入力 [Enter] 221 example.jp Connection closed by foreign host. PHP から送信 †下のPHPスクリプトをサーバに設置してアクセスする メール受信テスト †[root@linux ~]# telnet localhost 110 Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. +OK <4432.1213348186@example.jp> user user@example.jp ←■ ユーザ名 [Enter] +OK pass "パスワード入力" ←■ パスワード [Enter] +OK stat ←■ STAT [Enter] で受信しているメールの件数とバイト数を取得する +OK 2 3133 list ←■ LIST [Enter] でメール一覧取得する +OK 1 1555 2 1559 . retr 1 ←■ "RETR+LISTで取得した番号" [Enter] でメール内容の確認 +OK メールの内容が表示される . dele 1 ←■ "DELE+LISTで取得した番号" [Enter] でメールの削除 +OK quit ←■ QUIT [Enter] で終了 +OK [root@linux ~]# メール不正中継拒否テスト †
Relay test result All tests performed, no relays accepted. となればOK telnetでサービスポート確認 †[root@linux ~]# telnet localhost 110 ←■ POP3が使用するサービスポート110番がフリーになっていることを確認します。 Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused telnet: Unable to connect to remote host: Connection refused [root@linux ~]# [root@linux ~]# telnet localhost 143 ←■ IMAP4が使用するサービスポート143番がフリーになっていることを確認します。 Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused telnet: Unable to connect to remote host: Connection refused [root@linux ~]# MXレコードの設定 †httpサーバ と メールサーバが異なる場合 †
nslookup で確認 †[root@linux ~]# nslookup -type=mx example.jp Server: 192.168.11.1 Address: 192.168.11.1#53 Non-authoritative answer: ←■ ① example.jp mail exchanger = 10 mx1.example.jp. ←■ ② Authoritative answers can be found from: example.jp nameserver = ns2.value-domain.com. example.jp nameserver = ns3.value-domain.com. example.jp nameserver = ns1.value-domain.com. mx1.example.jp internet address = 125.3.123.28 ←■ ③ ns3.value-domain.com internet address = 59.106.14.70 [root@linux ~]#
|