: O. Yuanying

Leopardでメールサーバ

したいこと

  • Maildir形式
  • IMAPで受信

Postfixの設定

/etc/postfix/main.cfを編集して、以下を追加。

myhostname = fraction.jp
home_mailbox = Maildir/

Daemon化

Activating Postfix on OS X 10.4 (Tiger)からpostfix-tiger.tarというファイルをダウンロードして解凍する。

解凍してできたPostfixというフォルダをStartupItemsに登録し、オーナをroot:wheelに変更後、実行権をつける。

[yuanying@Kohrin Downloads]$wget http://www.david-reitter.com/software/postfix-tiger.tar
--11:09:00--  http://www.david-reitter.com/software/postfix-tiger.tar
           => `postfix-tiger.tar'
...
[yuanying@Kohrin Downloads]$tar xvf postfix-tiger.tar 
Postfix/
Postfix/Postfix
Postfix/StartupParameters.plist
[yuanying@Kohrin Downloads]$cd /System/Library/StartupItems/
[yuanying@Kohrin StartupItems]$ll
[yuanying@Kohrin StartupItems]$sudo mv ~/Downloads/Postfix ./
[yuanying@Kohrin StartupItems]$sudo chown -R root:wheel Postfix
[yuanying@Kohrin StartupItems]$sudo chmod +rx Postfix/Postfix

また、/etc/hostconfigにMAILSERVER=-YES-の一行を加える。

[yuanying@Kohrin StartupItems]$sudo vim /etc/hostconfig
[yuanying@Kohrin StartupItems]$more /etc/hostconfig
# This file is going away
...
MAILSERVER=-YES-

postfixの起動

[yuanying@Kohrin StartupItems]$sudo /usr/sbin/postfix start
postfix/postfix-script: starting the Postfix mail system

えらいあっけない、これでちゃんと動いたのか確認。

[yuanying@Kohrin ~]$mail -s test yuanying
Hi!!!
EOT
[yuanying@Kohrin ~]$ll
...
drwx------   5 yuanying  staff   170 11  1 12:13 Maildir/
...

ちゃんとMaildirフォルダの中のnewフォルダに送ったメールが届いてることが確認できました。

次回はIMAPで受信に挑戦。

参考

ほとんど参考ページそのまま。このページはとてもシンプルでわかりやすくて良いな。