<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>仙人の心得 &#187; postfix</title>
	<atom:link href="http://blog.mktime.com/archive/tag/postfix/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.mktime.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 31 Aug 2010 12:04:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.mktime.com/archive/tag/postfix/feed" />
		<item>
		<title>php：Postfixで自動返信メール</title>
		<link>http://blog.mktime.com/archive/76.html</link>
		<comments>http://blog.mktime.com/archive/76.html#comments</comments>
		<pubDate>Sun, 12 Apr 2009 12:14:33 +0000</pubDate>
		<dc:creator>nak</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[postfix]]></category>

		<guid isPermaLink="false">http://blog.mktime.com/?p=76</guid>
		<description><![CDATA[
メールを受信するサーバにメール受信用ユーザを登録する。

受信するメールアドレスは[ユーザ名]@ホスト名になります。

# adduser [ユーザ名]
# passwd [パスワード]


.forwardに転送設定 [...]]]></description>
			<content:encoded><![CDATA[<p>
メールを受信するサーバにメール受信用ユーザを登録する。<br />
<br />
受信するメールアドレスは[ユーザ名]@ホスト名になります。<br />
<div class="console">
# adduser [ユーザ名]<br />
# passwd [パスワード]<br />
</div>
<br />
.forwardに転送設定を記述<br />
<br />
<div class="caption">/home/[ユーザ名]/.forward</div>
<div class="file">
register,&#8221;| /usr/bin/php /path/to/autoreply.php<br />
</div>
<br />
.転送先はphpスクリプト。パイプでメール内容を渡している。<br />
<br />
autoreply.php（返信処理の内容）はこんなふうになる。<br />
<pre class="brush: php;">
require_once(&quot;Mail/mimeDecode.php&quot;); //REARモジュール
//メールソースを標準入力から読み込み
$source = file_get_contents(&quot;php://stdin&quot;);
if(!$source) {
    return false;    // 読み込み失敗
}
 
//メール解析
$params['include_bodies'] = true;
$params['decode_bodies'] = true;
$params['decode_headers'] = true;
$decoder = new Mail_mimeDecode($source);
$structure = $decoder-&gt;decode($params);
 
// 送信者のメールアドレスを取得する
$from_address = mb_convert_encoding(mb_decode_mimeheader($structure-&gt;headers['from'])
                         ,mb_internal_encoding(), &quot;auto&quot;);
</pre>
このスクリプトを標準入力無しで起動すると<br />
<br />
$source = file_get_contents(&#8220;php://stdin&#8221;);<br />
<br />
のところで入力待ちになって処理が中断しますが、ヘッダさえもnullなメールを送ることは出来ないので多分気にしなくてもいいはず。 </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mktime.com/archive/76.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.mktime.com/archive/76.html" />
	</item>
		<item>
		<title>postfix：インストールとmtaの切り替え</title>
		<link>http://blog.mktime.com/archive/11.html</link>
		<comments>http://blog.mktime.com/archive/11.html#comments</comments>
		<pubDate>Wed, 09 Jul 2008 12:39:42 +0000</pubDate>
		<dc:creator>nak</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[mta]]></category>
		<category><![CDATA[sendmail]]></category>

		<guid isPermaLink="false">http://blog.mktime.com/?p=9</guid>
		<description><![CDATA[
sendmailが入っているサーバにpostfixを入れるメモ。

まず、postfixのインストール

# yum install postfix


次に設定。/etc/postfix/main.cfに記述する。
 [...]]]></description>
			<content:encoded><![CDATA[<p>
sendmailが入っているサーバにpostfixを入れるメモ。<br />
<br />
まず、postfixのインストール<br />
<pre class="console">
# yum install postfix
</pre>
<br />
次に設定。/etc/postfix/main.cfに記述する。<br />
<pre class="console">
# cp /etc/postfix/main.cf /etc/postfix/main.cf.org
# vi /etc/postfix/main.cf
</pre>
<div class="caption">/etc/postfix/main.cf</div>
<pre class="file">
myhostname = 自ホスト名
mydomain = $mydomain
myorigin = $mydomain
#inet_interfaces = all
inet_interfaces = localhost
mynetworks_style = host
mynetworks = xxx.xxx.xxx.xxx
smtpd_banner = $myhostname ESMTP
home_mailbox = Maildir/
</pre>
<br />
<table class="t-left">
    <caption>main.cfのパラメタ抜粋</caption>
    <tr>
        <th>パラメータ名</th><th>説明</th>
    </tr>
    <tr>
        <td>myhostname</td><td>自ホスト名<br />DNSで引けるドメイン名であること。</td>
    </tr>
    <tr>
        <td>mydomain</td><td>自ドメイン名<br />postfixの名前解決に使用する。ホスト名を省略したとき、このlocalhost.$mydomainに送信される。</td>
    </tr>
    <tr>
        <td>mynetworks_style</td><td>信頼できるSMTPクライアントアドレス<br />host,subnet,classが指定できる。</td>
    </tr>
    <tr>
        <td>mynetworks</td><td>信頼できるSMTPクライアントアドレス<br />mynetworks_styleよりも詳細に設定するときに使う。,（カンマ）またはスペースで区切ってsabunetをいくつも設定できる。ここを設定するとmynetworks_styleは無視される。</td>
    </tr>
    <tr>
        <td>home_mailbox</td><td>mailboxの形式<br /></td>
    </tr>
</table>
<br />
mtaの切り替え。<br />
<pre class="console">
# /usr/sbin/alternatives --config mta

There are 2 programs which provide 'mta'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/sbin/sendmail.sendmail
   2           /usr/sbin/sendmail.postfix

Enter to keep the current selection[+], or type selection number:
</pre>
ここでpostfix・・・2を選ぶ。<br />
<br />
設定したらpostfixを起動＆initスクリプトの登録。<br />
<pre class="console">
# /etc/init.d/postfix start
# /sbin/chkconfig postfix on
</pre>
<br />
sendmailは止める。<br />
<pre class="console">
# /etc/init.d/sendmail stop
# /sbin/chkconfig sendmail off
</pre>
<br />
必ず不正中継のテストをすること。　<a href="http://www.abuse.net/relay.html">Mail relay testing</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mktime.com/archive/11.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.mktime.com/archive/11.html" />
	</item>
		<item>
		<title>postfix:メールの保存形式と設定方法</title>
		<link>http://blog.mktime.com/archive/5.html</link>
		<comments>http://blog.mktime.com/archive/5.html#comments</comments>
		<pubDate>Mon, 07 Jul 2008 13:12:40 +0000</pubDate>
		<dc:creator>nak</dc:creator>
				<category><![CDATA[postfix]]></category>

		<guid isPermaLink="false">http://blog.mktime.com/?p=3</guid>
		<description><![CDATA[
postfixはメールをmbox、MailDir形式、cyrus形式で保存できる。デフォルトの設定ではmbox形式。

mbox、MailDirの違いはざっと↓。

mbox
全てのメールを1ファイルで保存する。
ファ [...]]]></description>
			<content:encoded><![CDATA[<p>
postfixはメールをmbox、MailDir形式、cyrus形式で保存できる。デフォルトの設定ではmbox形式。<br />
<br />
mbox、MailDirの違いはざっと↓。<br />
<br />
<strong>mbox</strong><br />
全てのメールを1ファイルで保存する。<br />
ファイルサイズは非常に大きくなる。サイズの大きくなったmboxにアクセスするとサーバ負荷は高くなる。<br />
全てのメールが1ファイルで保存されているのでファイルが壊れたときの影響が大きい。また排他処理も同様の理由で不利である。<br />
<br />
<strong>MailDir</strong><br />
ユーザディレクトリのMailDirフォルダ以下に1メールを1ファイルで保存する。<br />
mbox形式の弱点が解消されるほか、MailDirフォルダに容量制限をかけることが出来る。<br />
欠点はファイル増加によるパフォーマンス低下。<br />
<br />
<strong>cyrus</strong>（よく解りません・・・）<br />
ユーザディレクトリ以外の場所に1メールを1ファイルで保存する。<br />
連携できるアプリが多いのが長所みたい。<br />
<br />
<strong>設定方法</strong><br />
1.main.cfを編集してメールの保存方法を設定します。<br />
<br />
/etc/postfix/main.cf<br />
#home_mailbox = Mailbox<br />
#home_mailbox = Maildir/<br />
mbox形式ならMailbox、MailDir、cyrus形式ならMaildir/をコメントアウトする<br />
※Maildir/は&#8221;/まで&#8221;必要！<br />
<br />
2.postfixを再起動する<br />
/etc/init.d/postfix restart<br />
<br />
参考サイト：　<a title="postfixのページ" href="http://www.postfix-jp.info/">posyfixのぺーじ</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mktime.com/archive/5.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.mktime.com/archive/5.html" />
	</item>
	</channel>
</rss>
