Linux Mail-Queue mini-HOWTO <author>Leif Erlingsson, <tt/leif@lege.com/, Jan P Tietze, <tt/jptietze@mail.hh.provi.de/ <date>v2.02, 03 September 1997, sendmail 8.8.7 <trans>伊佐治 哲, <tt/isaji@mxu.meshnet.or.jp/ <tdate>2 Feb 1998 <abstract> <tt>Queue Remote Mail + Deliver Local Mail</tt>について。 <!-- The Configuration Changes Neccessary to Make Sendmail Deliver Local Mail ***Now*** While Stashing Remote Mail in The Queue Until &dquot;I Say So&dquot;. --> この文書はSendmailでローカルメールの配送をするために必要な設定の変更について 書かれています。&dquot;指示する&dquot;までキュー(Queue)にリモート メールを蓄えておきます。 </abstract> <!-- 訳注: Other stuff(patch, program, FAQ and so on), see below: http://www.lege.com This is Leif Erlingsson's homepage. --> <!-- Table of contents --> <toc> <!-- Begin the document --> <sect>イントロダクション <!-- 1 Introduction--> <p> <!-- The document is written by two authors. The NON dial-on-demand solutions part (oldest part) is written by Leif Erlingsson <leif@lege.com>, and the newer dial-on-demand solutions part is written by Jan P Tietze <jptietze@mail.hh.provi.de>. --> このドキュメントは共著で書かれています。ダイアルオンデマンドを使わない解決法に ついては(古いものは) Leif Erlingsson <leif@lege.com> によって書かれ、新しいダイアルオンデマンドの解決法は Jan P Tietze <jptietze@mail.hh.provi.de> によって書かれました。 <sect>ダイアルオンデマンドを使わない解決<label id="NON"> <!-- 2 NON dial-on-demand solutions PART--> <p> Written by Leif Erlingsson <leif@lege.com>. <p> <!-- The original version of this part contained a lot of unnecessary stuff. This is all it takes, really... --> このパートのオリジナルバージョンでは不必要なものもたくさん含まれていました。 これはそれも取り上げたものです...。 <sect1>sendmailのスタート <!-- 2.1 Starting sendmail--> <p> <!-- Slackware et al: /etc/rc.d/rc.M: --> Slackwareなど: <tt>/etc/rc.d/rc.M</tt>: <tscreen><verb> echo &dquot;Starting sendmail daemon (/usr/sbin/sendmail -bd -os) [queue only mode]...&dquot; /usr/sbin/sendmail -bd -os # NOT &dquot;-bd -q 15m&dquot;, the &dquot;standard&dquot; flags! </verb></tscreen> [参考 <p> Slackware default) <code> /etc/rc.d/rc.M: # Start the sendmail daemon: if [ -x /usr/sbin/sendmail ]; then echo "Starting sendmail daemon (/usr/sbin/sendmail -bd -q 15m)..." /usr/sbin/sendmail -bd -q 15m fi </code> <p> man sendmail: <descrip> <tag>-q[time]</tag> 指示された間隔でキュー(<tt>var/spool/mqueue</tt>)に保存したメッセージ を処理します。時間が省略されると一度だけキューを処理します。timeは`s'が秒 、`m'が分、`h'が時間、`d'が日、`w'が週をあらわしています。例えば`-q1h30m' や`-q90m'はタイムアウトを1時間30分に設定します。時間になるとsendmailはバック グランドで実行されます。このオプションは-bdとともに使ったほうが安全です。 <tag>-bd</tag> デーモンとして実行します。これはBerkeley IPCを必要とします。sendmailはSMTP 接続用のsocket 25(<tt>/etc/services</tt>)にリストされていてバックグランドで フォークし実行されます。 </descrip> ] <!-- RedHat et al: /etc/rc.d/init.d/sendmail.init: --> RedHatなど: <tt>/etc/rc.d/init.d/sendmail.init</tt>: <tscreen><verb> echo -n &dquot;Starting sendmail: [queue only mode]&dquot; daemon sendmail -bd -os # NOT daemon sendmail -bd -q1h </verb></tscreen> <!-- The -os is not really essential, all it does is this: --> <tt/-os/は基本的なものではありません。このオプションは: <!-- <tscreen><verb>内本文 SuperSafe [s] Be super-safe when running things, i.e., always instantiate the queue file, even if you are going to attempt immediate delivery. Sendmail always instantiates the queue file before returning control the client under any circumstances. This should really always be set. --> <tscreen><verb> スーパーセーフ [s] これを付けていればと安全です。例えば、キュー ファイルを直接配送しようとする時でも常に呼び出します。sendmailはある環境 でクライアントをコントロールする前に常にキューファイルを呼び出します。これは 常にセットされています。 </verb></tscreen> <!-- This should already be configured in the default sendmail.cf anyway.--> これはデフォルトのsendmail.cfで常に設定されています。 [参考:man sendmail <descrip> <tag>oオプション</tag> <!-- If set, this message may have old style headers. If not set, this message is guaranteed to have new style headers (i.e., commas instead of spaces between addresses). If set, an adaptive algorithm is used that will correctly determine the header format in most cases. --> これをセットしていると、メッセージは古いスタイルのヘッダも処理できるように なります。セットしていないとメッセージは新しいスタイルのヘッダだけ保証されます (例えばアドレス間のスペースの代わりにコンマを使うなど)。セットしてあると 適当なアルゴリズムがヘッダフォーマットを多くのケースで正しく決定 するように使われます。 <tag>sオプション</tag> <!-- Always instantiate the queue file, even under circumstances where it is not strictly necessary. This provides safety against system crashes during delivery. --> 全く必要ない環境下でもキューファイルを常に呼び出します。 これは配送中のシステムクラッシュに対しても安全です。 </descrip> ] <sect1>sendmailの設定<label id="m4"> <!-- 2.2 Configuring sendmail--> <p> <!-- Serious sendmail users use the m4 source for this. I recommend this solution if you ever plan on upgrading sendmail and also make anything but trivial changes to sendmail.cf. --> まじめなsendmailユーザーは設定を行うためにm4ソースを使います。 sendmailをアップグレードしたり、ささいなsendmail.cfの変更以外ならなんでも この方法を行うことをお奨めします。 <p> <!-- If you never intend to fix sendmail so envelope return headers et al works even though you might be on dynamic dial in IP or something, then you may not need to get the m4 source. --> IPなどを動的ダイアルにしたいけれど、sendmailでの解決はしたくなく リターンヘッダなどで動作させる場合はm4ソースを使う必要はありません。 <sect2>ちょっとした設定のためにsendmail.cfを直接設定する <!-- 2.2.1 Configuring sendmail.cf directly, for trivial configurations --> <p> <!-- This way of doing things is extremeley version dependent vs. extremely typo?? sendmail.cf versions. The following solution is *only* valid for sendmail-8.8.x. --> この方法はきわめてsendmail.cfバージョンに対して依存しています。 以下の方法は<tt/sendmail-8.8.x/<em/のみ/で有効です。 <!-- Edit /etc/sendmail.cf: --> <tt>/etc/sendmail.cf</tt>の編集: <tscreen><verb> # avoid connecting to &dquot;expensive&dquot; mailers on initial submission? O HoldExpensive=True </verb></tscreen> 後半 .... <tscreen><verb> ##### @(#)smtp.m4 8.33 (Berkeley) 7/9/96 ##### Msmtp, P=[IPC], F=mDFMuXe, S=11/31, R=21, E=\r\n, L=990, T=DNS/RFC822/SMTP, A=IPC $h Mesmtp, P=[IPC], F=mDFMuXae, S=11/31, R=21, E=\r\n, L=990, T=DNS/RFC822/SMTP, A=IPC $h Msmtp8, P=[IPC], F=mDFMuX8e, S=11/31, R=21, E=\r\n, L=990, T=DNS/RFC822/SMTP, A=IPC $h Mrelay, P=[IPC], F=mDFMuXa8e, S=11/31, R=61, E=\r\n, L=2040, T=DNS/RFC822/SMTP, A=IPC $h </verb></tscreen> <!-- The important flag above is ``e''. Don't fuss if the other flags look different in your file. Keep your flags as-is, only add ``e'' to your flags according to the above examples, unless it's there already. ``e'' marks the mailers as ``expensive''. --> 上で大切なフラグ(訳注:<tt/F=/の箇所)は&dquot;e&dquot;です。 あなたのファイルで他のフラグがあっても気にしないで下さい。 フラグはそのままにして、&dquot;e&dquot;がない時に限り 上の例のようにフラグ&dquot;e&dquot;のみを追加して下さい。 &dquot;e&dquot;は&dquot;expensive&dquot;としてメーラーを示しています。 <sect2>m4ソースを使ってsendmailを設定する <!-- 2.2.2 Configuring sendmail.cf using m4 source --> <p> <!-- In the following I will, for simplicity, assume that the sendmail version is 8.8.7. If you have a different version, replace 8.8.7 with that version number below! Also, the instructions will not work for older versions of sendmail. Get the latest sendmail! --> 以下簡単にするためにsendmailのバージョンは8.8.7であるとします。もし違う バージョンを使うなら8.8.7をそのバージョンに置き換えて読んでいってください。 また命令はsendmailの古いバージョンでは実行できません。最新のsendmailを 入手して下さい! <p> <!-- Download the sendmail source. Try ``http://WWW.Sendmail.ORG'' or possibly ``ftp.sendmail.org''. --> sendmailソースは <htmlurl url="http://WWW.Sendmail.ORG" name="http://WWW.Sendmail.ORG"> かできれば <htmlurl url="ftp://ftp.sendmail.org" name="ftp://ftp.sendmail.org"> でダウンロードして下さい。 <p> <!-- I also recommend that you obtain my patch for allowing envelope sender reverse aliasing and other nice stuff to really make you take control over your mail environment. --> 私のパッチを入手することもお奨めします。エンベロープセンダーが逆エイリアス するようにしたパッチと、その他メール環境を経由してコントロールできるようにする スタッフがあります。 <p> <!-- Write to ``Sendmail Patch <sendmail@lege.com>'', Subject: ``sendmail-8.8.7'', if 8.8.7 is your sendmail version. --> sendmailバージョンが8.8.7なら: <htmlurl url="mailto:sendmail@lege.com" name="Sendmail Patch <sendmail@lege.com>"> 宛てにSubjectを <quote> Subject:sendmail-8.8.7 </quote> としてメールを送って下さい[訳注:本文には特に何も書きません。メール を送ると折り返しMIMEメールで送られてきます。MIMEで送られてくるものは <tt/xaliases-2.0.tar.gz/, <tt/sendmail-8.8.7-cf-cpio-idcmu.gz/です)]。 <!-- They are also available from ``http://www.lege.com'', as is the sgml source of this mini-HOWTO! --> このmini-HOWTOのsgmlソースについては <htmlurl url="http://www.lege.com" name="http://www.lege.com"> からも入手できます。 <p> <!-- You don't have to get my patches in order to get ``Queue Remote Mail + Deliver Local Mail'' to work. My patches solve other things. But I just thought this would be a nice place to mention them, as many Linux users will find them extremely useful. (They will even give you properly working virtual domains, if you like. The virtual domains don't have to be ``local''. They will give you ``xaliases'', or in other words ``reverse aliasing''.) --> 「Queue Remote Mail + Deliver Local Mail」を動作させるために著者のパッチ を使わないで下さい。パッチはその他のことを解決するためのものです。ですが 多くのLinuxユーザーがこのパッチが役立つものであると気づくように言うのはよい と思います。このパッチは仮想ドメインを動作させます。仮想ドメインは 「ローカル」であるべきではありません。<tt/xaliases/あるいは言い換えて 逆エイリアス(<tt/reverse aliasing/)を与えるものです。 <p> <!-- Unpack the sendmail source. You may get /usr/src/sendmail-8.8.7/. cd /usr/src/sendmail-8.8.7/cf --> sendmailソースを展開すると <tt>/usr/src/sendmail-8.8.7/</tt> ディレクトリができます。 <tt>/usr/src/sendmail-8.8.7/cf</tt>に移動して下さい。 <!-- Now overlay my patch, if you want it, otherwise skip this step: If you don't want to use procmail as Local Delivery Agent, save away your /usr/src/sendmail-8.8.7/cf/ostype/linux.m4 before doing this... Save my patch to ``/tmp/sendmail-8.8.7-cf-cpio-idcmu.gz'', then... --> 必要ならパッチを当てて次のステップに進んで下さい。LDA(Local Delivery Agent) としてprocmailを使わないならパッチをあてず、作業を行う前に <tt>/usr/src/sendmail-8.8.7/cf/ostype/linux.m4</tt> を保存しておいて下さい。パッチは <tt>/tmp/sendmail-8.8.7-cf-cpio-idcmu.gz</tt> に保存して <tscreen><verb> cd /usr/src/sendmail-8.8.7/cf gzip -dc < /tmp/sendmail-8.8.7-cf-cpio-idcmu.gz | cpio -idcmu </verb></tscreen> とします。 <!-- If you didn't want to use procmail, write back the saved copy of /usr/src/sendmail-8.8.7/cf/ostype/linux.m4 again. --> procmailを使わない場合は <tt>/usr/src/sendmail-8.8.7/cf/ostype/linux.m4</tt> の保存したコピーを元通りに書き戻して下さい。 <!-- And regardless of if you applied my patch or not, you must make sure these lines or very similar ones are added to /usr/src/sendmail-8.8.7/cf/cf/yourhostname.smtp.mc (but if you applied my patch you may want to investigate filenames containing the word ``elijah'', under /usr/src/sendmail-8.8.7/cf): --> パッチをあてていなくてもこれらの行を確認して、 <tt>/usr/src/sendmail-8.8.7/cf/cf/yourhostname.smtp.mc</tt> に同じものがあてられているのを確認します。 (しかしパッチを当てるなら<tt>/usr/src/sendmail-8.8.7/cf</tt> 以下の&dquot;elijah&dquot;を含むファイル名を調べてみて下さい): <tscreen><verb> dnl # Defer Delivery to "expensive" mailers until next time the dnl # queue is processed using "O HoldExpensive=True" and make dnl # sure smtp mailers are "expensive". dnl # (See original "sendmail" book Chapter 30: Options, dnl # "Oc - Don't connect to expensive mailers", or dnl # 2nd Edition "sendmail" book Chapter 34.8.29, dnl # "HoldExpensive (c), Queue for expensive mailers".) dnl # / Leif Erlingsson <leif@lege.com> define(`confCON_EXPENSIVE', `True') define(SMTP_MAILER_FLAGS, e) MAILER(local)dnl MAILER(smtp)dnl </verb></tscreen> <sect1>メニューサポートの提案 <!-- 2.3 Menu support suggestions --> <p> <!-- The 1.x versions of this document contained Menu support suggestions for /var/X11R6/lib/fvwm/system.fvwmrc. I have dropped those in the current version, but they are available on request: --> このドキュメントのバージョン 1.x では <tt>/var/X11R6/lib/fvwm/system.fvwmrc</tt> に関する(訳注:ヴィンドウマネージャの)メニューサポートの提案も含まれて いました。現在のバージョンではこれはなくしましたが、必要なら取り寄せる こともできます: <p> <!-- Write to ``Menu support suggestions <fvwmrc@lege.com>'', Subject: ``Menu support suggestions'' --> メールの Subject: に <quote> Menu support suggestions </quote> と書いて <htmlurl url="mailto:fvwmrc@lege.com" name="Menu support suggestions <fvwmrc@lege.com> "> 宛てに送って下さい(訳注:本文には何も書きません。メールを送ると 折り返しMIMEメールで送られてきます)。 <sect>ダイアルオンデマンドによる解決 <!-- 3 Dial-on-demand solutions PART --> <p> Written by Jan P Tietze <jptietze@mail.hh.provi.de>. <p> <!-- Many Linux users access the Internet through a dialup line, and many have decided to implement dial-on-demand facilities on their system. That is, whenever an IP packet of some sort has to leave the local network or the local host, the link to an Internet Service Provider (ISP) will automatically be established. The link will be dropped after some period of time that no packet has travelled across. --> 多くのLinuxユーザーはダイアルアップ回線を使ってインターネットに接続して います。またシステム上にダイアルオンデマンド(<tt/dial-on-demand/)の機能を 実装しています。つまり、ある種類のIPパケットがローカルネットワーク/ローカル ホストを出る時はいつでも、ISP(<tt/Internet Service Provider/)へのリンクが自動的 に確立されるということです。パケットが無くなるとリンクはダウンします。 <p> <!-- Although this is very comfortable and cost effective, there is one special case in which this is neither comfortable (as the time to bring up a &dquot;traditional&dquot; modem dialup is very noticeable) nor cost effective, and this is sending e-mail. E-Mail is commonly sent by SMTP, either delivered by your own system or through a SMTP host on the Internet that usually resides in your ISP's network. --> これは快適で有効なものですが、もしかしたら快適でもなく(古いモデムでの ダイアルアップが著しく)有効ではないこともあります。これは電子メールを送り ます。電子メールは一般にあなたのシステムによって配送されるかインターネット 上のSMTPホストを経由してSMTPによって配送されます。普通インターネット上の SMTPホストはISPのネットワークにあります。 <p> <!-- With dialup lines, every time you send a message the link will have to be brought up. This is quite okay if you send only one message, but if you happen to create and send multiple messages, bringing up the line more than once can be tedious and cost ineffective. Also, if your ISP imposes limits as to what times you are allowed to login, this would also restrict you to postpone messages at certain times of the day, and you would have to manually send them later. --> ダイアルアップ回線ではメッセージを送る時は常にリンクされていなければな りません。これはひとつのメッセージを送るだけならいいのですが、複数の メッセージを書いて送る時は何度も回線に接続しなくてはならず 面倒で手間のかかることです。またISPが許可しているログイン時間(訳注:例えば UUCPで1日に1回接続するなど)を制限している場合は、1日のある時間しか メッセージを送信できません。そして後からメールを手動で送らなければなりません。 <p> <!-- Section 1 of this document will solve the situation, however in situations where an external DNS lookup would cause the link up, the link will still be established even if e-mail is just being queued. The reason is that sendmail wishes to &dquot;canonify&dquot; host names. --> このドキュメントの<ref id="NON" name="ダイアルオンデマンドを使わない解決"> でこの状況を解決していますが、外部DNSがリンクアップしている状況では、リンク は電子メールがキューにある場合でさえも確立されます。 理由はsendmailがhost名を基準化(&dquot;canonify&dquot;)しようとするからです。 <p> <!-- The solution to this problem is twofold: First, we'll have to moderately change sendmail.cf. And then we have to define the process of actual mail delivery. Personally, I prefer to have cron do the job for me and describe the necessary changes below. --> この問題に対する解決法は2つあります。<tt/sendmail.cf/を適当に変更して 実際のメール配送のプロセスを定義することです。個人的には<tt/cron/を使って ジョブ管理をさせています。以下必要な変更を説明していきます。 <sect1>sendmail.cfの設定 <!-- 3.1 Configuring sendmail.cf --> <p> <!-- For the reasons stated in [1.2], I recommend modifying the m4 sources instead of editing sendmail.cf directly. It will actually save you a lot of hassle and make configuration changes more verbose. --> <ref id="m4" name="sendmailの設定">で書かれた理由もあり、<tt/sendmail.cf/を 直接編集するかわりにm4ソースを修正することをお奨めします。m4ソースを使えば多く の困難や設定変更の冗長さから救われます。 <p> <!-- First, perform all the changes described in the first part of this document. Then go through the dial-on-demand specific stuff. --> はじめに、このドキュメントのはじめで記述した変更を行います。 そしてダイアルオンデマンドの特定のスタッフを調べます。 <sect2>ちょっとした設定をするためにsendmail.cfを直接設定する。 <!-- 3.1.1 Configuring sendmail.cf directly, for trivial configurations --> <p> <!-- Configuring directly is highly impractical and anything but verbose, but obviously, this is your decision. --> じかに設定することはあまり実際的ではなく冗長です。しかしこれはあなた 次第です。 <!-- Close to very bottom of your sendmail.cf should be a line that reads: --> sendmail.cfの終りあたりの行で: <tscreen><verb> R$* < @ $* $˜P > $* $: $1 < @ $[ $2 $3 $] > $4 </verb></tscreen> <!-- Precede that line with a &dquot;#&dquot; so that it reads --> とあります。&dquot;#&dquot;を行頭に置きます: <tscreen><verb> #R$* < @ $* $˜P > $* $: $1 < @ $[ $2 $3 $] > $4 </verb></tscreen> <sect2>m4ソースを使ってsendmail.cfを設定する <!-- 3.1.2 Configuring sendmail.cf using the m4 source. --> <p> <!-- Add the following line to /usr/src/sendmail-8.8.7/cf/cf/yourhostname.smtp.mc: --> 以下の行を<tt>/usr/src/sendmail-8.8.7/cf/cf/yourhostname.smtp.mc</tt>に 追加します: <tscreen><verb> FEATURE(nocanonify)dnl </verb></tscreen> <!-- Your final sendmail.cf can then be built by issuing the following commands. Remember to always back up your old /etc/sendmail.cf before installing the new one: --> 最終のsendmail.cfは以下のコマンドを実行して起動します。新しいものをインス トールする前に古い<tt>/etc/sendmail.cf</tt>を保存しておいて下さい: <tscreen><verb> cp /etc/sendmail.cf /etc/sendmail.cf.bak cd /usr/src/sendmail-8.8.7/cf/cf m4 yourhostname.smtp.mc > /etc/sendmail.cf </verb></tscreen> <sect1>ダイアル遅延の追加 <!-- 3.2 Adding dial delay--> <p> <!-- It is oftentimes useful, especially when using modem lines, to have a dial delay installed. This means that if sendmail tries to initiate a connection in an attempt to send an e-mail (and this causes the line to go up) but the link actually takes more time to get established than what sendmail thinks should be a reasonable timeout, sendmail will simply wait some seconds and then retry. --> 場合によっては便利です。特にモデム回線を使っているときはダイアル遅延を インストールしておきましょう。これはsendmailが電子メールを送ろう(これは回線の 接続を意味します)として接続を開始するけれど、sendmailでタイムアウトする時間 よりもリンク接続の確立のほうに時間がかかるといった場合、sendmailは数秒 待ってから接続を試みます。 <sect2>sendmail.cfの設定 <!-- 3.2.1 Configuring sendmail.cf directly --> <p> <!-- Somewhere in your sendmail.cf could be a line that would read: --> sendmail.cfのどこかに以下の行があります <tscreen><verb> #O DialDelay=10s </verb></tscreen> <!-- (or very similar). Delete the ``#''. If there's no ``#'' at the beginning of the line, things should be considered okay (it just means this had already been enabled before). --> &dquot;#&dquot;を削除します。行頭に&dquot;#&dquot;がない場合は 問題ありません(以前この行を有効にしていたというだけです)。 [訳注:Slackwareパッケージなどでは <tt>/usr/src/sendmail</tt> ディレクトリに<tt/README.linux, *.cf/ファイルがあります] <!-- If there is no such line in your sendmail.cf, add one (it is a wise thing to do to add this in the &dquot;options&dquot; part of the file): --> sendmail.cfにこの行がない場合は以下の行を追加しておいて下さい(ファイルの &dquot;option(オプション)&dquot;パートに追加しておくとよいでしょう)。 <tscreen><verb> O DialDelay=10s </verb></tscreen> <!-- Now change the ``10s'' part to the number of seconds you deem suitable. --> &dquot;10s&dquot;の部分を適当な秒数に変更します。 <sect2> m4を使ったsendmail.cfの設定 <!-- 3.2.2 Configuring sendmail.cf using m4 source --> <p> <!-- Add the following line to /usr/src/sendmail-8.8.7/cf/cf/yourhostname.smtp.mc: --> <tt>/usr/src/sendmail-8.8.7/cf/cf/yourhostname.smtp.mc</tt> に以下の行を追加します: <tscreen><verb> define(`confDIAL_DELAY',`10s') </verb></tscreen> <!-- Now change the ``10s'' part to the number of seconds you deem suitable. --> ここで&dquot;10s&dquot;の部分を適当な秒数に変更します。 <!-- Your final sendmail.cf can then be built by issuing the following commands. Remember to always back up your old /etc/sendmail.cf before installing the new one: --> 最終的なsendmail.cfは以下のコマンドを実行して構築できます。 新しいものをインストールする前に古い<tt>/etc/sendmail.cf</tt>を保存 しておいて下さい: <tscreen><verb> cp /etc/sendmail.cf /etc/sendmail.cf.bak cd /usr/src/sendmail-8.8.7/cf/cf m4 yourhostname.smtp.mc > /etc/sendmail.cf </verb></tscreen> <sect>e-mailの配送 <!-- 3 delivering e-mail --> <p> <!-- e-mail delivery can be invoked by issuing the command &dquot;sendmail -q&dquot;. for those who are interested in what sendmail actually does, &dquot;sendmail -q -v&dquot; will give a more verbose version of the delivery process. --> 電子メールの配送は&dquot;sendmail -q&dquot;コマンドを実行することで 行われます。sendmailが行っていることに興味がある人は &dquot;sendmail -q -v&dquot;とすれば配送プロセスの経過を表示してくれます。 <p> [<tt/-v/オプションを付けてsendmailを実行すると、 <verb> Running RAA18307 (sequence 1 of 3) <user@mail.server.or.jp>... Connecting to mail.server.or.jp. via smtp... 220 sv220.tk.mmm.ad.jp ESMTP Sendmail 8.8.4+2.7Wbeta4/3.5Wpl1-97120410; Thu >>> EHLO your.server.name.jp 250-sv220.tk.mmm.ad.jp Hello city1DU22.mmm.ad.jp [000.000.000.000], ple 250-8BITMIME 250-SIZE 250-DSN 250-ONEX 250-ETRN 250-XUSR 250 HELP >>> MAIL From:<user@mail.server.or.jp> SIZE=5 250 <user@mail.server.or.jp>... Sender ok >>> RCPT To:<user@mail.server.or.jp> 250 <user@mail.server.or.jp>... Recipient ok >>> DATA 354 Enter mail, end with "." on a line by itself >>> . 250 RAA15115 Message accepted for delivery <user@mail.server.or.jp>... Sent (RAA15115 Message accepted for delivery) </verb> といったメッセージが出力されます。cronで実行されると出力結果などが メールで送信されるので確認などできます。 <p> メールがロックされて&dquot;sendmail -q -v&dquot;としても送信されない ケースがあります。これは、<tt>/etc/rc.d/rc.M</tt>で設定している sendmailに<tt>-q</tt>オプションを設定していたり、メーラでbodyを書いている 時に&dquot;sendmail -q&dquot;が実行されロックされるなど原因は様々です。 何かよい解決方法があれば教えて下さい。 <p> <tt>/var/spool/mqueue</tt>以下にメールはキューされています。そのファイルの 中でサイズが0byteのものがあるとそのメールはロックされています。 送信されないメールは1週間すると送信者にリターンされます。 <tt>/var/spool/mqueue</tt>以下のメールファイルで、頭2文字が qfのものはヘッダファイル、dfのものはbody、xfはロックされている時にある ファイルです。頭2文字以下の名前は<tt>Message Id</tt>などで表示されるもの です] <p> <!-- it is very convenient to automate the process of e-mail delivery. a tool commonly used for this process is cron. --> メール配送のプロセスを自動化することは簡単です。これにはcronを使います。 <sect1>特定の時間にメールを配送するには? <!-- 3.1 How to have e-mail delivered at special times. --> <p> <!-- Edit your crontab:--> crontabを編集します: <tscreen><verb> crontab -e </verb></tscreen> <!-- Add lines of the form:--> 以下のフォームを追加します: <tscreen><verb> 05 18-23,0-7 * * Mon,Tue,Wed,Thu,Fri /usr/sbin/sendmail -q 05 * * * Sat,Sun /usr/sbin/sendmail -q </verb></tscreen> <!-- Please refer to the crontab man page (available through &dquot;man 5 \ crontab&dquot;) for further information. I think the format is pretty obvious. The example crontab entries shown above send e-mail (if, and only if, e-mail is available from the queue) 5 minutes after an hour on weekdays, starting at 6:05 pm, and stopping at 7:05 am. On weekends, e-mail is delivered 5 minutes after an hour, starting at 12:05 pm on Saturday, and stopping 11:05 pm on Sunday. --> 詳細についてはcrontabのmanページを参照してください (&dquot;man 5 crontab&dquot;で参照できます)。フォーマットはもう明らかです。 上で書かれたcrontabエントリの例では、(メールがキューにある時のみ)メールを 各曜日の各時間5分後(午後6:05にスタートし午前7:05にストップ)に送信します。 また週末には各時間5分後にメールが配送されます(土曜日の午後12:05にスタートし 日曜日の午後11:05にストップ)。 <p> <!-- As a dial-on-demand user, it is sometimes desirable to have your system collect your e-mail via the POP3 protocol at certain times of the day. You could therefore add an entry similar to the following to your crontab: --> ダイアルオンデマンドユーザーとして、特定の時間にPOP3プロトコル経由でメールを 受信したいと思うことがあります。そこで以下のエントリを同じようにcrontabに 追加します。 <tscreen><verb> 0 21 * * * popclient -3 -u <あなたのPOP3ユーザー名> -p <あなたのパスワード> -o /var/spool/mail/<受信したメールを受けるシステム上のユーザー名> <mailhost.somedomain.com> </verb></tscreen> <!-- Of course, this should all go on a single line. Then, save the file and leave the editor. The crontab should now be installed. --> もちろんこれは一行で書かれます。ファイルに保存しエディタを終了させます。 crontabはこれでインストールされます(訳注:popclientを使うよりもfetchmail などを使ったほうがセキュリティ上よいと思います)。 <p> [訳者:伊佐冶 哲, <tt/isaji@mxu.meshnet.or.jp/ <p> 訳文に関する間違い、不明な点があればご連絡下さい。] </article>