Created
July 7, 2012 20:04
-
-
Save KitaitiMakoto/3067932 to your computer and use it in GitHub Desktop.
Rubyでメールを送る ref: http://qiita.com/items/688d383dc831c8b9a7f9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'English' | |
if File.basename($PROGRAM_NAME) == File.basename(__FILE__) | |
SampleMailer.first_example('There is a body.').deliver | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
format.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby ./template.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby ./template.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
password> | |
There is 北市真's body. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby ./mail.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem install actionmailer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby ./actionmailer.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts mail.to | |
puts mail.body |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'English' | |
if File.basename($PROGRAM_NAME) == File.basename(__FILE__) | |
mail = TemplateMailer.template_example('北市真') | |
puts mail.body | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There is <%= @name %>'s body. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment