Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- #use Unicode
- $KCODE = 'u'
- require 'jcode'
- require 'rubygems'
- require 'action_mailer'
- require 'tlsmail' #need install tlsmail gem to support TLS connect
- Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)
- ActionMailer::Base.smtp_settings = {
- :address => 'smtp.gmail.com', #default: localhost
- :port => '25', #default: 25
- :user_name => 'xxx@gmail.com',#login name
- :password => 'xxx', #login password
- :authentication => :login #:plain, :login or :cram_md5
- }
- class SimpleMailer < ActionMailer::Base
- def simple_message(recipient, mail_subject, mail_body)
- from 'xxx@gmail.com'
- recipients recipient
- subject mail_subject
- body mail_body
- end
- end
- msg = ARGV[0]
- SimpleMailer.deliver_simple_message 'xxx@gmail.com', 'ruby - SystemMessage', msg
Add Comment
Please, Sign In to add comment