<?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>HattaraTecLog &#187; シェルスクリプト</title>
	<atom:link href="http://teclog.hattara.info/?feed=rss2&#038;tag=%E3%82%B7%E3%82%A7%E3%83%AB%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88" rel="self" type="application/rss+xml" />
	<link>http://teclog.hattara.info</link>
	<description>LinuxネタとかPHPネタとかの技術ログ</description>
	<lastBuildDate>Tue, 18 Nov 2014 12:15:20 +0000</lastBuildDate>
	<language>ja</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.8</generator>
	<item>
		<title>perlとかシェルスクリプトとかでメールを送る</title>
		<link>http://teclog.hattara.info/?p=43</link>
		<comments>http://teclog.hattara.info/?p=43#comments</comments>
		<pubDate>Mon, 20 Oct 2008 10:12:47 +0000</pubDate>
		<dc:creator><![CDATA[hattara]]></dc:creator>
				<category><![CDATA[perl]]></category>
		<category><![CDATA[シェルスクリプト]]></category>
		<category><![CDATA[shellscript]]></category>

		<guid isPermaLink="false">http://teclog.hattara.info/?p=43</guid>
		<description><![CDATA[ちょっとしたことでメールをしたいときに、 シェルスクリプト(shellscript) とかパール(perl)と [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>ちょっとしたことでメールをしたいときに、<br />
シェルスクリプト(shellscript) とかパール(perl)とかで<br />
メール配信・送信をする訳ですが、以下のような感じでできるのでメモ。</p>
<p>【シェルスクリプト】</p>
<blockquote><p>
#!/bin/sh</p>
<p>wToAddress=&#8221;test@test.com&#8221;</p>
<p>f_SendMail(){<br />
    wToAddress=$1<br />
    wSubject=$2<br />
    wMsg=$3</p>
<p>    echo $wMsg | mail -s &#8220;${wSubject}&#8221; &#8220;${wToAddress}&#8221;<br />
}</p>
<p>f_SendMail &#8220;${wToAddress}&#8221; &#8220;Test Subject.&#8221; &#8220;Test Mail Message.&#8221;</p>
<p>exit
</p></blockquote>
<p>【perl】</p>
<blockquote><p>
#!/usr/bin/perl</p>
<p>my $sendmail = &#8216;/usr/sbin/sendmail&#8217;;<br />
my $nkf = &#8216;/usr/bin/nkf&#8217;;</p>
<p>open(SENDMAIL,&#8221;| $nkf -j | $sendmail -t -i&#8221;);</p>
<p>print SENDMAIL <<'END';<br />
From: test@test.com<br />
To: test_to@test.com<br />
Subject: テストサブジェクト</p>
<p>テストメッセージ</p>
<p>END</p>
<p>close(SENDMAIL);
</p></blockquote>
<p>みたいな感じですね。<br />
シェルスクリプトのほうも、たぶんnkfかませば、日本語いけると思う。<br />
前にやってたような気がするけど、記憶がないので。。</p>
]]></content:encoded>
			<wfw:commentRss>http://teclog.hattara.info/?feed=rss2&#038;p=43</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
