wemaにメール通知機能を追加

即興で。
sticky.rbにこんなコードを追加した。



def send_mail
open("| /usr/sbin/sendmail -t", "w") {|f|
mail = Kconv.tojis <<EOS
From: foo@bar.com
To: baz@zoo.com
Content-Type: text/plain; charset=iso-2022-jp
MIME-Version: 1.0
Subject: 書き込みがありました。

書き込みがありました。

                    • -

#{@source}

                    • -

EOS
f << mail
}
end

def save_to_file(dir, rebuild = true)
if rebuild
enc = Wema::Encode.new
@content = enc.convert(@source,@sid)
plg = Wema::Plugin.new
plg.run(self)
end
csv = CSVParser.new
csv << CSVLine.new([@content,@source,@sid,@left,@top,@color,@parent,@lock,@zindex])
csv.write_to_file("#{dir}/#{@sid}.txt")
send_mail if dir != "./pages/DustBox"
end

もう少し、うまくメールと連携できるといいなあ…


追記
「固定」でもメールがとんでくるー。
修正しよ。