Skip to content

Instantly share code, notes, and snippets.

@KitaitiMakoto
Created July 7, 2012 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KitaitiMakoto/3067932 to your computer and use it in GitHub Desktop.
Save KitaitiMakoto/3067932 to your computer and use it in GitHub Desktop.
Rubyでメールを送る ref: http://qiita.com/items/688d383dc831c8b9a7f9
require 'English'
if File.basename($PROGRAM_NAME) == File.basename(__FILE__)
SampleMailer.first_example('There is a body.').deliver
end
format.html
ruby ./template.rb
ruby ./template.rb
password>
There is 北市真's body.
ruby ./mail.rb
gem install actionmailer
ruby ./actionmailer.rb
puts mail.to
puts mail.body
# ActionMailerの設定色々
# ActionMailer::Base...
module Batch
class Aggregate
# ...
# 色々のバッチ処理
# ...
def report_done
Mailer.done.deliver
end
def report_error(exception)
# 例外情報からエラーメッセージを作る
# error_message = ...
Mailer.error(error_message).deliver
end
class Mailer < ActionMailer::Base
def done
# 正常終了を報告するメールを送る
end
def error(error_message)
# エラーを報告するメールを送る
end
end
end
end
require 'English'
if File.basename($PROGRAM_NAME) == File.basename(__FILE__)
mail = TemplateMailer.template_example('北市真')
puts mail.body
end
There is <%= @name %>'s body.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment