ここではSquirrelMail(スクイリルメール)を使用してOutlook等のメールソフトを使用しなくても
Hotmailや、Yahoo!メールのようにWebブラウザ上でメールの送受信ができるようにします。

※ Webサーバー、PHP、サーバー通信暗号化、メールサーバーが構築済みであることが前提となります。

SquirrelMailのインストール


SquirrelMail(スクイリルメール)日本語バージョン本体と、日本語化ファイル(locales)をダウンロード
本体の最新版はこちらを確認

Localesの最新版はこちらを確認

# wget http://www.yamaai-tech.com/~masato/Download/squirrelmail-1.4.10a-ja-20070731.tar.gz ← 本体DL

# wget http://downloads.sourceforge.net/squirrelmail/ja_JP-1.4.9-20070106.tar.gz?modtime=1168106199&big_mirror=1 ← localesのDL


# cd /home/httpd/html/ ← インストールするディレクトリに移動


# tar zxfv /root/squirrelmail-1.4.10a-ja-20070731.tar.gz ← 本体展開

# mv squirrelmail-1.4.10a-ja webmail ← 展開してできたディレクトリの名前をwebmailに変更

# cd ← /rootに戻る


# tar zxfv ja_JP-1.4.9-20070106.tar.gz ← 日本語化ファイルの展開

# rm -rf /home/httpd/html/webmail/help/ ← ノーマルのhelpファイル削除


# ./install ← 日本語化ファイルののインストール
Please enter path to your squirrelmail installation:/home/httpd/html/webmail ← インストール先を指定


# chmod 730 data ← ディレクトリのパーミッション変更

# chown -R apache:apache data ← 所有権をApache(httpd.confに記載)のユーザとグループに変更


# rm -f ./install ← 展開ディレクトリの削除

# rm -f /help ← 展開ディレクトリの削除

# rm -f /locale ← 展開ディレクトリの削除

# rm -f quirrelmail-1.4.10a-ja-20070731.tar.gz ← DLファイルの削除

# rm -f ja_JP-1.4.9-20070106.tar.gz ← DLファイルの削除

SquirrelMailの設定


# cd /home/httpd/html/webmail ← 移動

# ./configure ←設定ツール起動

設定ツールが起動すると以下のような画面が表示されます。

使用するIMAPサーバーの設定

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Main Menu --
1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books
7. Message of the Day (MOTD)
8. Plugins
9. Database
10. Languages

D. Set pre-defined settings for specific IMAP servers

C Turn color on
S Save data
Q Quit

Command >> d ← dを指定(IMAPサーバの設定)

SquirrelMail Configuration : Read: config_default.php
---------------------------------------------------------
While we have been building SquirrelMail, we have discovered some
preferences that work better with some servers that don't work so
well with others. If you select your IMAP server, this option will
set some pre-defined settings for that server.

Please note that you will still need to go through and make sure
everything is correct. This does not change everything. There are
only a few settings that this will change.

Please select your IMAP server:
cyrus = Cyrus IMAP server
uw = University of Washington's IMAP server
exchange = Microsoft Exchange IMAP server
courier = Courier IMAP server
macosx = Mac OS X Mailserver
hmailserver = hMailServer
quit = Do not change anything
Command >> courier ← courierを指定

imap_server_type = courier
default_folder_prefix = INBOX.
trash_folder = Trash
sent_folder = Sent
draft_folder = Drafts
show_prefix_option = false
default_sub_of_inbox = false
show_contain_subfolders_option = false
optional_delimiter = .
delete_folder = true

Press any key to continue... 「Enter」


ログアウトしたときに表示されるページを指定

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Main Menu --
1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books
7. Message of the Day (MOTD)
8. Plugins
9. Database
10. Languages

D. Set pre-defined settings for specific IMAP servers

C Turn color on
S Save data
Q Quit

Command >> 1 ← 1を指定

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Organization Preferences
1. Organization Name : SquirrelMail
2. Organization Logo : ../images/sm_logo.png
3. Org. Logo Width/Height : (308/111)
4. Organization Title : SquirrelMail $version
5. Signout Page :
6. Top Frame : _top
7. Provider link : http://www.squirrelmail.org/
8. Provider name : SquirrelMail

R Return to Main Menu
C Turn color on
S Save data
Q Quit

Command >> 5 ← 5を指定

When users click the Sign Out button they will be logged out and
then sent to signout_page. If signout_page is left empty,
(hit space and then return) they will be taken, as normal,
to the default and rather sparse SquirrelMail signout page.

[]: /webmail ← /webmailを指定(ログアウトしたらログインページに戻るようにする)

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Organization Preferences
1. Organization Name : SquirrelMail
2. Organization Logo : ../images/sm_logo.png
3. Org. Logo Width/Height : (308/111)
4. Organization Title : SquirrelMail $version
5. Signout Page : /webmail
6. Top Frame : _top
7. Provider link : http://www.squirrelmail.org/
8. Provider name : SquirrelMail

R Return to Main Menu
C Turn color on
S Save data
Q Quit

Command >> r ← メニューに戻る


ドメイン名の設定

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Main Menu --
1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books
7. Message of the Day (MOTD)
8. Plugins
9. Database
10. Languages

D. Set pre-defined settings for specific IMAP servers

C Turn color on
S Save data
Q Quit

Command >> 2 ← 2を指定

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1. Domain : example.com
2. Invert Time : false
3. Sendmail or SMTP : SMTP

A. Update IMAP Settings : localhost:143 (courier)
B. Update SMTP Settings : localhost:25

R Return to Main Menu
C Turn color on
S Save data
Q Quit

Command >> 1 ← 1を指定

The domain name is the suffix at the end of all email addresses. If
for example, your email address is jdoe@example.com, then your domain
would be example.com.

[example.com]: xxxxx.com ← ドメイン名を指定


SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1. Domain : xxxxx.com
2. Invert Time : false
3. Sendmail or SMTP : SMTP

A. Update IMAP Settings : localhost:143 (courier)
B. Update SMTP Settings : localhost:25

R Return to Main Menu
C Turn color on
S Save data
Q Quit


Command >> r ← メニューに戻る


言語の設定

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Main Menu --
1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books
7. Message of the Day (MOTD)
8. Plugins
9. Database
10. Languages

D. Set pre-defined settings for specific IMAP servers

C Turn color on
S Save data
Q Quit

Command >> 10 ← 10を指定

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Language preferences
1. Default Language : en_US
2. Default Charset : iso-8859-1
3. Enable lossy encoding : false

R Return to Main Menu
C Turn color on
S Save data
Q Quit

Command >> 1 ← 1を指定

SquirrelMail attempts to set the language in many ways. If it
can not figure it out in another way, it will default to this
language. Please use the code for the desired language.

[en_US]: ja_JP ← 日本語を指定

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Language preferences
1. Default Language : ja_JP
2. Default Charset : iso-8859-1
3. Enable lossy encoding : false

R Return to Main Menu
C Turn color on
S Save data
Q Quit

Command >> 2 ← 2を指定

This option controls what character set is used when sending
mail and when sending HTML to the browser.

This option is used only when default language is 'en_US'.

[iso-8859-1]: iso-2022-jp ← iso-2022-jpを指定

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Language preferences
1. Default Language : ja_JP
2. Default Charset : iso-2022-jp
3. Enable lossy encoding : false

R Return to Main Menu
C Turn color on
S Save data
Q Quit

Command >> r ← メニューに戻る


SquirrelMailのバージョン非表示化

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Main Menu --
1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books
7. Message of the Day (MOTD)
8. Plugins
9. Database
10. Languages

D. Set pre-defined settings for specific IMAP servers

C Turn color on
S Save data
Q Quit

Command >> 4 ← 4を指定

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
General Options
1. Data Directory : ../data/
2. Attachment Directory : $data_dir
3. Directory Hash Level : 0
4. Default Left Size : 150
5. Usernames in Lowercase : false
6. Allow use of priority : true
7. Hide SM attributions : false
8. Allow use of receipts : true
9. Allow editing of identity : true
Allow editing of name : true
Remove username from header : false
10. Allow server thread sort : false
11. Allow server-side sorting : false
12. Allow server charset search : true
13. Enable UID support : true
14. PHP session name : SQMSESSID

R Return to Main Menu
C Turn color on
S Save data
Q Quit

Command >> 7 ← 7を指定

Hide SM attributions (y/n) [n]: y ← yでログインページでSquirrelMailのバージョンを表示しないようにする

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
General Options
1. Data Directory : ../data/
2. Attachment Directory : $data_dir
3. Directory Hash Level : 0
4. Default Left Size : 150
5. Usernames in Lowercase : false
6. Allow use of priority : true
7. Hide SM attributions : true
8. Allow use of receipts : true
9. Allow editing of identity : true
Allow editing of name : true
Remove username from header : false
10. Allow server thread sort : false
11. Allow server-side sorting : false
12. Allow server charset search : true
13. Enable UID support : true
14. PHP session name : SQMSESSID

R Return to Main Menu
C Turn color on
S Save data
Q Quit

Command >> q ← 終了

You have not saved your data.
Save? [Y/n]: y ← 保存


必須プラグインの導入
プラグインの説明
 Compatibility → プラグインを全てのバージョンのSquirrelMailでそのまま動くようにする。
 Empty         → Trash(ゴミ箱フォルダ)を自動的に空にする。
 Secure        → ログイン時に自動的にhttps(SSL)でアクセスする。

# cd ← rootディレクトリに戻る

プラグインのダウンロード

最新版はこちら
# wget http://www.squirrelmail.org/countdl.php?fileurl=http%3A%2F%2Fwww.squirrelmail.org%2Fplugins%2Fcompatibility-2.0.8-1.0.tar.gz

最新版はこちら
# wget http://www.squirrelmail.org/countdl.php?fileurl=http%3A%2F%2Fwww.squirrelmail.org%2Fplugins%2Fempty_trash-1.4-1.2.2.tar.gz

最新版はこちら
# wget http://www.squirrelmail.org/countdl.php?fileurl=http%3A%2F%2Fwww.squirrelmail.org%2Fplugins%2Fsecure_login-1.3-1.2.8.tar.gz


# cd /home/httpd/html/webmail/plugins/ ← プラグインディレクトリに移動

# tar zxvf /root/compatibility-2.0.8-1.0.tar.gz ← compatibilityを解凍

# tar zxvf /root/empty_trash-1.4-1.2.2.tar.gz ← empty_trashを解凍

# tar zxvf /root/secure_login-1.3-1.2.8.tar.gz ← secure_loginを解凍


# rm -f /root/compatibility-2.0.8-1.0.tar.gz ← ダウンロードしたファイル削除

# rm -f /root/empty_trash-1.4-1.2.2.tar.gz ← ダウンロードしたファイル削除

# rm -f /root/secure_login-1.3-1.2.8.tar.gz ← ダウンロードしたファイル削除


# cd /home/httpd/html/webmail ← 移動

# ./configure ← 設定ツール起動

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books
7. Message of the Day (MOTD)
8. Plugins
9. Database
10. Languages

D. Set pre-defined settings for specific IMAP servers

C Turn color on
S Save data
Q Quit

Command >> 8 ← 8を指定

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
Installed Plugins

Available Plugins:
1. info
2. translate
3. squirrelspell
4. spamcop
5. filters
6. calendar
7. abook_take
8. fortune
9. administrator
10. newmail
11. bug_report
12. sent_subfolders
13. mail_fetch
14. listcommands
15. message_details
16. delete_move_next
17. compatibility
18. empty_trash
19. secure_login

R Return to Main Menu
C Turn color on
S Save data
Q Quit

Command >> 17 ← compatibilityの番号を選択(番号は環境によって異なります)

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
Installed Plugins
1. compatibility

Available Plugins:
2. info
3. translate
4. squirrelspell
5. spamcop
6. filters
7. calendar
8. abook_take
9. fortune
10. administrator
11. newmail
12. bug_report
13. sent_subfolders
14. mail_fetch
15. listcommands
16. message_details
17. delete_move_next
18. empty_trash
19. secure_login

R Return to Main Menu
C Turn color on
S Save data
Q Quit

Command >> 18 ← empty_trashの番号を選択(番号は環境によって異なります)

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
Installed Plugins
1. compatibility
2. empty_trash

Available Plugins:
3. info
4. translate
5. squirrelspell
6. spamcop
7. filters
8. calendar
9. abook_take
10. fortune
11. administrator
12. newmail
13. bug_report
14. sent_subfolders
15. mail_fetch
16. listcommands
17. message_details
18. delete_move_next
19. secure_login

R Return to Main Menu
C Turn color on
S Save data
Q Quit

Command >> 19 ← secure_loginの番号を選択(番号は環境によって異なります)

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
Installed Plugins
1. compatibility
2. empty_trash
3. secure_login

Available Plugins:
4. info
5. translate
6. squirrelspell
7. spamcop
8. filters
9. calendar
10. abook_take
11. fortune
12. administrator
13. newmail
14. bug_report
15. sent_subfolders
16. mail_fetch
17. listcommands
18. message_details
19. delete_move_next

R Return to Main Menu
C Turn color on
S Save data
Q Quit

Command >> q ← 終了

You have not saved your data.
Save? [Y/n]: y ← 保存
Data saved in config.php

Exiting conf.pl.
You might want to test your configuration by browsing to
http://your-squirrelmail-location/src/configtest.php
Happy SquirrelMailing!

ログイン時のエラー対策




# cd /home/httpd/html/webmail ← 移動

# ./configure ←設定ツール起動

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages

D.  Set pre-defined settings for specific IMAP servers

C   Turn color on
S   Save data
Q   Quit

Command >> 4 ← 4を指定


1.  Data Directory              : /var/local/squirrelmail/data/
2.  Attachment Directory        : /var/local/squirrelmail/attach/
3.  Directory Hash Level        : 0
4.  Default Left Size           : 150
5.  Usernames in Lowercase      : false
6.  Allow use of priority       : true
7.  Hide SM attributions        : true
8.  Allow use of receipts       : true
9.  Allow editing of identity   : true
    Allow editing of name       : true
    Remove username from header : false
10. Allow server thread sort    : false
11. Allow server-side sorting   : false
12. Allow server charset search : true
13. Enable UID support          : true
14. PHP session name            : SQMSESSID
15. Location base               :

R   Return to Main Menu
C   Turn color on
S   Save data
Q   Quit

Command >> 1 ← 1を指定


Specify the location for your data directory.
The path name can be absolute or relative (to the config directory).
You probably need to create this directory yourself. Here are two examples:
  Absolute:    /var/local/squirrelmail/data/
  Relative:    ../data/
Relative paths to directories outside of the SquirrelMail distribution
will be converted to their absolute path equivalents in config.php.

Note: There are potential security risks with having a writable directory
under the web server's root directory (ex: /home/httpd/html).
For this reason, it is recommended to put the data directory
in an alternate location of your choice.

[/var/local/squirrelmail/data/]: /home/httpd/html/webmail/data/ ← 実際のdataディレクトリを指定


General Options
1.  Data Directory              : /home/httpd/html/webmail/data/
2.  Attachment Directory        : /var/local/squirrelmail/attach/
3.  Directory Hash Level        : 0
4.  Default Left Size           : 150
5.  Usernames in Lowercase      : false
6.  Allow use of priority       : true
7.  Hide SM attributions        : true
8.  Allow use of receipts       : true
9.  Allow editing of identity   : true
    Allow editing of name       : true
    Remove username from header : false
10. Allow server thread sort    : false
11. Allow server-side sorting   : false
12. Allow server charset search : true
13. Enable UID support          : true
14. PHP session name            : SQMSESSID
15. Location base               :

R   Return to Main Menu
C   Turn color on
S   Save data
Q   Quit

Command >> q ← 終了

You have not saved your data.
Save?  [Y/n]: y ← 保存
Data saved in config.php

Exiting conf.pl.
You might want to test your configuration by browsing to
http://your-squirrelmail-location/src/configtest.php
Happy SquirrelMailing!


http://サーバーIPアドレス/webmail/にアクセスして
SquirrelMailログインページが表示されていればOKです。


また、URLが
https://サーバーIPアドレス/webmail/src/login.php?secure_login=yes
となっているか確認して下さい。
ログイン後の画面はこんな感じです。

PHP5を導入後、メール送信時のエラー対処法(squirrelmail-1.4.10aではこのエラーは解決済)



PHP4を使用時は問題なくメール送信できていたのですが、PHP5を導入後、メール送信時に下記のエラーが出ます。
何やらSquirrelMailがPHPの新バージョンに未対応らしいです。

※ 管理人Yosiもこのエラーにずっとハマっていましたが、やっと解決方法が分かりましたのでここで紹介したいと思います。

エラー:
エラー: メッセージを追加できません INBOX.Sent.
サーバの応答: Error in IMAP command received by server.


エラー:
エラー: メッセージを追加できません INBOX.Sent.
サーバの応答: Error in IMAP command received by server.


エラー:
エラー: imapサーバが接続を切断しました。
Query: SELECT "INBOX"


# vi /home/httpd/html/webmail/functions/imap_general.php ← 設定ファイル編集

888行目付近の下記の部分を変更してください。

fputs ($imap_stream, sqimap_session_id() . " APPEND \"$sent_folder\" (\\Seen) \{$length}\r\n");
 ↓
fputs ($imap_stream, sqimap_session_id() . " APPEND \"$sent_folder\" (\\Seen) {".$length."}\r\n");




Copyright c Vine Linuxで自宅サーバー. 2004 All Rights Reserved.