<?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/"
	>

<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>修行の日々を淡々と</description>
	<lastBuildDate>Thu, 05 May 2011 07:39:25 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<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>admin</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に転送設定を記述 /home/[ユーザ名]/.forward register,&#8221;&#124; /usr/bin/php /path/to/autoreply.php .転送先はphpスクリプト。パイプでメール内容を渡している。 autoreply.php（返信処理の内容）はこんなふうになる。 [sourcecode language='php'] require_once(&#8220;Mail/mimeDecode.php&#8221;); //REARモジュール //メールソースを標準入力から読み込み $source = file_get_contents(&#8220;php://stdin&#8221;); if(!$source) { return false; // 読み込み失敗 } //メール解析 $params['include_bodies'] = true; $params['decode_bodies'] = true; $params['decode_headers'] = true; $decoder = new Mail_mimeDecode($source); $structure = $decoder->decode($params); // 送信者のメールアドレスを取得する $from_address = mb_convert_encoding(mb_decode_mimeheader($structure->headers['from']) ,mb_internal_encoding(), &#8220;auto&#8221;); [/sourcecode] [...]]]></description>
			<content:encoded><![CDATA[<p>メールを受信するサーバにメール受信用ユーザを登録する。</p>
<p>受信するメールアドレスは[ユーザ名]@ホスト名になります。</p>
<div class="console">
# adduser [ユーザ名]<br />
# passwd [パスワード]
</div>
<p>.forwardに転送設定を記述</p>
<div class="caption">/home/[ユーザ名]/.forward</div>
<div class="file">
register,&#8221;| /usr/bin/php /path/to/autoreply.php
</div>
<p>.転送先はphpスクリプト。パイプでメール内容を渡している。</p>
<p>autoreply.php（返信処理の内容）はこんなふうになる。<br />
[sourcecode language='php']<br />
require_once(&#8220;Mail/mimeDecode.php&#8221;); //REARモジュール<br />
//メールソースを標準入力から読み込み<br />
$source = file_get_contents(&#8220;php://stdin&#8221;);<br />
if(!$source) {<br />
    return false;    // 読み込み失敗<br />
}</p>
<p>//メール解析<br />
$params['include_bodies'] = true;<br />
$params['decode_bodies'] = true;<br />
$params['decode_headers'] = true;<br />
$decoder = new Mail_mimeDecode($source);<br />
$structure = $decoder->decode($params);</p>
<p>// 送信者のメールアドレスを取得する<br />
$from_address = mb_convert_encoding(mb_decode_mimeheader($structure->headers['from'])<br />
                         ,mb_internal_encoding(), &#8220;auto&#8221;);<br />
[/sourcecode]<br />
このスクリプトを標準入力無しで起動すると</p>
<p>$source = file_get_contents(&#8220;php://stdin&#8221;);</p>
<p>のところで入力待ちになって処理が中断しますが、ヘッダさえもnullなメールを送ることは出来ないので多分気にしなくてもいいはず。 </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mktime.com/archive/76.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</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>admin</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に記述する。 # cp /etc/postfix/main.cf /etc/postfix/main.cf.org # vi /etc/postfix/main.cf /etc/postfix/main.cf 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/ main.cfのパラメタ抜粋 パラメータ名 説明 myhostname 自ホスト名DNSで引けるドメイン名であること。 mydomain 自ドメイン名postfixの名前解決に使用する。ホスト名を省略したとき、このlocalhost.$mydomainに送信される。 mynetworks_style 信頼できるSMTPクライアントアドレスhost,subnet,classが指定できる。 mynetworks 信頼できるSMTPクライアントアドレスmynetworks_styleよりも詳細に設定するときに使う。,（カンマ）またはスペースで区切ってsabunetをいくつも設定できる。ここを設定するとmynetworks_styleは無視される。 home_mailbox [...]]]></description>
			<content:encoded><![CDATA[<p>sendmailが入っているサーバにpostfixを入れるメモ。</p>
<p>まず、postfixのインストール</p>
<pre class="console">
# yum install postfix
</pre>
<p>次に設定。/etc/postfix/main.cfに記述する。</p>
<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>
<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の形式</td>
</tr>
</table>
<p>mtaの切り替え。</p>
<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>
<p>ここでpostfix・・・2を選ぶ。</p>
<p>設定したらpostfixを起動＆initスクリプトの登録。</p>
<pre class="console">
# /etc/init.d/postfix start
# /sbin/chkconfig postfix on
</pre>
<p>sendmailは止める。</p>
<pre class="console">
# /etc/init.d/sendmail stop
# /sbin/chkconfig sendmail off
</pre>
<p>必ず不正中継のテストをすること。　<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>
		</item>
		<item>
		<title>postfix:メールの保存形式と設定方法</title>
		<link>http://blog.mktime.com/archive/296.html</link>
		<comments>http://blog.mktime.com/archive/296.html#comments</comments>
		<pubDate>Mon, 07 Jul 2008 13:12:40 +0000</pubDate>
		<dc:creator>admin</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ファイルで保存する。 ファイルサイズは非常に大きくなる。サイズの大きくなったmboxにアクセスするとサーバ負荷は高くなる。 全てのメールが1ファイルで保存されているのでファイルが壊れたときの影響が大きい。また排他処理も同様の理由で不利である。 MailDir ユーザディレクトリのMailDirフォルダ以下に1メールを1ファイルで保存する。 mbox形式の弱点が解消されるほか、MailDirフォルダに容量制限をかけることが出来る。 欠点はファイル増加によるパフォーマンス低下。 cyrus（よく解りません・・・） ユーザディレクトリ以外の場所に1メールを1ファイルで保存する。 連携できるアプリが多いのが長所みたい。 設定方法 1.main.cfを編集してメールの保存方法を設定します。 /etc/postfix/main.cf #home_mailbox = Mailbox #home_mailbox = Maildir/ mbox形式ならMailbox、MailDir、cyrus形式ならMaildir/をコメントアウトする ※Maildir/は&#8221;/まで&#8221;必要！ 2.postfixを再起動する /etc/init.d/postfix restart 参考サイト：　posyfixのぺーじ]]></description>
			<content:encoded><![CDATA[<p>postfixはメールをmbox、MailDir形式、cyrus形式で保存できる。デフォルトの設定ではmbox形式。</p>
<p>mbox、MailDirの違いはざっと↓。</p>
<p><strong>mbox</strong><br />
全てのメールを1ファイルで保存する。<br />
ファイルサイズは非常に大きくなる。サイズの大きくなったmboxにアクセスするとサーバ負荷は高くなる。<br />
全てのメールが1ファイルで保存されているのでファイルが壊れたときの影響が大きい。また排他処理も同様の理由で不利である。</p>
<p><strong>MailDir</strong><br />
ユーザディレクトリのMailDirフォルダ以下に1メールを1ファイルで保存する。<br />
mbox形式の弱点が解消されるほか、MailDirフォルダに容量制限をかけることが出来る。<br />
欠点はファイル増加によるパフォーマンス低下。</p>
<p><strong>cyrus</strong>（よく解りません・・・）<br />
ユーザディレクトリ以外の場所に1メールを1ファイルで保存する。<br />
連携できるアプリが多いのが長所みたい。</p>
<p><strong>設定方法</strong><br />
1.main.cfを編集してメールの保存方法を設定します。</p>
<p>/etc/postfix/main.cf<br />
#home_mailbox = Mailbox<br />
#home_mailbox = Maildir/<br />
mbox形式ならMailbox、MailDir、cyrus形式ならMaildir/をコメントアウトする<br />
※Maildir/は&#8221;/まで&#8221;必要！</p>
<p>2.postfixを再起動する<br />
/etc/init.d/postfix restart</p>
<p>参考サイト：　<a title="postfixのページ" href="http://www.postfix-jp.info/">posyfixのぺーじ</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mktime.com/archive/296.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

