| はじめての自宅サーバ構築 - Fedora/CentOS - | Last Update | 2008/07/25 | |
| It opened to 2004/09/19. 当サイトはFedora9で運用しています |
Visitors Pageviews Today(IP/PV) |
3,374,109 12,761,988 1,267/8,610 |
# yum -y install fetchmail |
例)「linux」というユーザで外部メール(mail.hogehoge.netよりferoraというアカウントのメールを取り込む場合) 一般ユーザ「linux」になる # su - linux fetchmail設定ファイルの作成 $ vi .fetchmailrc # ログファイルの指定 set logfile "/var/log/fetchmail.log" # エラーの送信先 set postmaster root set no bouncemail # メールのチェック間隔(秒) set daemon 300 # デフォルト設定 defaults # プロトコルを指定(ex.[auto]or[pop2]or[APOP]or[RPOP]or[KPOP]or・・・) protocol pop3 # 既読のチェックを行う uidl # 未読メールの取り込み(ex.全て取り込む場合[fetchall]) no fetchall # サーバ上にメールを残す(ex.削除する場合[no keep]) keep # mimed ecode(8ビットデータに変換しない) no mimedecode # 送信サーバ(SMTPサーバ) smtphost localhost # 外部メールサーバの設定(取り込み元) poll mail.hogehoge.net # アカウント名 user fedora # パスワード password "himitsu" 同一外部メールサーバに複数のアカウントがある場合、「user」と「password」を列挙します。 他の外部メールサーバを取り込みたい場合、以下の「poll」から「password」を列挙します。 # 外部メールサーバの設定(取り込み元) poll mail.hogehoge.ne.jp # アカウント名 user fedora # パスワード password "himitsu" 設定ファイルを所有者のみRead/Writeにする $ chmod 600 .fetchmailrc |
起動と停止はfetchmail設定ファイルを作成したユーザで起動します。 fetchmailの起動 $ fetchmail fetchmailの停止 $ fetchmail --quit |
※:ダウンロードした「fetchmail.tar」が「/root/」直下にコピーした場合で説明します。 配置位置に移動 # cd /etc/rc.d/init.d/ tarファイルを展開 # tar xvf /root/fetchmail.tar カレント位置へ移動 # cd 展開したファイル存在の確認 # ls -l /etc/rc.d/init.d/fetchmail -rwxr-xr-x 1 root root 2721 4月 11 11:22 /etc/rc.d/init.d/fetchmail fetchmailスクリプトの動作検証 fetchmailスクリプトを開始 # /etc/rc.d/init.d/fetchmail start fetchmail for root starting... fetchmail for linux starting... fetchmailスクリプトを停止 # /etc/rc.d/init.d/fetchmail stop fetchmail for root stoping... fetchmail: バックグラウンドの fetchmail (PID=28758) が終了しました。 fetchmail for linux stoping... fetchmail: バックグラウンドの fetchmail (PID=28763) が終了しました。 fetchmailスクリプトをシステムに反映 fetchmailスクリプトをサービスに追加 # chkconfig --add fetchmail fetchmailスクリプトを自動起動に設定 # chkconfig fetchmail on |
| fetchmailログの確認 # cat /var/log/fetchmail.log fetchmail: fetchmail 6.2.5 デーモンを動作開始します。 fetchmail: 1 通のメッセージがアカウント fedora , サーバ pop.mail.xxx.xxx.xxx 宛に届いています。 (1178 バイト) fetchmail: fedora@pop.mail.xxx.xxx.xxx 宛に届いた 1 番目のメッセージ(全部で 1 通)を読み込んでいます (1178 バイト) fetchmail: サーバからメッセージを削除しませんでした。 fetchmail: 2005年09月22日 14時25分39秒 に休眠状態となりました。 |