Mail to multiple recipients
This commit is contained in:
@@ -22,7 +22,7 @@ class TariffsMailer
|
|||||||
|
|
||||||
mail = Mail.new do
|
mail = Mail.new do
|
||||||
delivery_method :smtp, smtp_opts
|
delivery_method :smtp, smtp_opts
|
||||||
to 'a.t.van.halteren@vu.nl'
|
to ['Mannetje <aart@van-halteren.net>','Vrouwtje <irene@van-halteren.net>']
|
||||||
from 'SmartMeter <aart@van-halteren.net>'
|
from 'SmartMeter <aart@van-halteren.net>'
|
||||||
subject "EasyEnergy tariffs for #{date}"
|
subject "EasyEnergy tariffs for #{date}"
|
||||||
|
|
||||||
|
|||||||
18
tariff_mailer.rb
Normal file
18
tariff_mailer.rb
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
require "rubygems"
|
||||||
|
require "bundler/setup"
|
||||||
|
require "active_record"
|
||||||
|
require "state_pattern"
|
||||||
|
|
||||||
|
project_root = File.dirname(File.absolute_path(__FILE__))
|
||||||
|
Dir.glob(project_root + "/app/models/*.rb").each{|f| require f}
|
||||||
|
Dir.glob(project_root + "/app/helpers/SearchingForSyncState.rb").each{|f| require f}
|
||||||
|
Dir.glob(project_root + "/app/helpers/*.rb").each{|f| require f}
|
||||||
|
|
||||||
|
connection_details = YAML::load(File.open('config/database.yml'))
|
||||||
|
ActiveRecord::Base.establish_connection(connection_details)
|
||||||
|
|
||||||
|
if __FILE__ == $0
|
||||||
|
# Tomorrows tariffs delivered today
|
||||||
|
TariffsMailer.deliver(Date.today.advance(days: 1))
|
||||||
|
end
|
||||||
|
#p sync
|
||||||
Reference in New Issue
Block a user