view xsotter_mail.rb @ 9:b62e23f84a36

to top comment
author KAMURA Sota <c109047@e.koeki-u.ac.jp>
date Fri, 10 Feb 2012 15:27:26 +0900
parents 2ebeaae57e96
children 83a2c410b901
line wrap: on
line source

#!/home/irhome/c109/c109047/sun4v/ruby/bin/ruby
# #! /usr/bin/env ruby
# -*- coding: euc-jp -*-

require '/home/irhome/c109/c109047/xsotter/xsotter_class'

sender = ENV['SENDER']
rcpt = ENV['RECIPIENT']
body = "" 
if sender == nil || rcpt === nil 
  exit 0
elsif/.*@.*/ !~ sender 
  exit 0
end
subject=""
while line = gets
  f=1 if /^$/=~line
  if f == 1 
   body += line 
  else
    subject = line.split(/:/)[1] if /Subject/ =~ line
  end
end

body = body.split(/^-+$/e)
post = body[0] + subject + body[0]

com=["-T", NKF.nkf('-e',post)]
#com=["-T", "test"]
xsotter=Xsotter.new("/home/irhome/c109/c109047/xsotter/c109047_token")
xsotter.comand(com)

yatex.org