<?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>func09 &#187; postfix</title>
	<atom:link href="http://www.func09.com/wordpress/archives/tag/postfix/feed" rel="self" type="application/rss+xml" />
	<link>http://www.func09.com/wordpress</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 06 Feb 2012 04:25:55 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Mac Leopard環境でActionMailerでメール送信できない時に見直すこと</title>
		<link>http://www.func09.com/wordpress/archives/254</link>
		<comments>http://www.func09.com/wordpress/archives/254#comments</comments>
		<pubDate>Mon, 10 Nov 2008 15:15:32 +0000</pubDate>
		<dc:creator>haga</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.func09.com/wordpress/?p=254</guid>
		<description><![CDATA[結論 可能性として Postfixが起動していない プロバイダのOP25B対策 がある プロセス 今日何時間も格闘したのでメモ。 MacでRails開発している際、普通にはActionMailerでメールを送信できない。 [...]]]></description>
			<content:encoded><![CDATA[<h2>結論</h2>

<p>可能性として</p>

<ul>
<li>Postfixが起動していない</li>
<li>プロバイダのOP25B対策</li>
</ul>

<p>がある</p>

<h2>プロセス</h2>

<p>今日何時間も格闘したのでメモ。</p>

<p>MacでRails開発している際、普通にはActionMailerでメールを送信できない。</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">config.action_mailer.raise_delivery_errors = true</div></div>

<p>の場合</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Errno::ECONNREFUSED: Connection refused - connect(2)</div></div>

<p>メール送信時にこんなエラーが出るはず。</p>

<p>で、そもそもNet::SMTPが使えていないっぽいのです。</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">% irb<br />
&gt;&gt; require 'net/smtp'<br />
&gt;&gt; smtp = Net::SMTP.start( 'localhost', 25 )<br />
Errno::ECONNREFUSED: Connection refused - connect(2)</div></div>

<p>ふむふむ。25ポートが空いてないっぽい。
そりゃそーだ。メールサーバ起動してないもん。。</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo postfix start</div></div>

<p>これで起動する。
Linuxの生活になれて、Postfixが起動していないというオチを考えてなかったため、ここまでに３時間くらいかかってます。</p>

<p>chkconfig的なものってないですかねぇ？</p>

<p>それでも送信できない場合は、そもそもmailが使えてない可能性が。</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">% echo 'Hi' | mail -s test mitsuru.haga@gmail.com<br />
% tail /var/log/mail.log</div></div>

<p>これで送信が成功しているかチェックしましょう。
プロバイダのOP25B対策で送信できていない可能性があるので、各プロバイダでリレーホストを調べて
/etc/postfix/main.cf
に追加します。</p>

<p>例えば、うちはKDDIなので</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">relayhost = relay-mta.auone-net.jp</div></div>

<p>こんな感じで追加しておきます。</p>

<p>以上</p>
]]></content:encoded>
			<wfw:commentRss>http://www.func09.com/wordpress/archives/254/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

