FogBugz #75: actually try to send some mail.
This commit is contained in:
parent
b50799e81d
commit
f89c1f1666
6 changed files with 24 additions and 10 deletions
|
|
@ -6,15 +6,26 @@ class BirthdaysController < ApplicationController
|
||||||
@birthdays = get_next_weeks_birthdays
|
@birthdays = get_next_weeks_birthdays
|
||||||
end
|
end
|
||||||
|
|
||||||
# curl --verbose --header "Accept: application/html" --header "Content-type: application/html" --request POST --data "" http://contactorama.dev/birthdays/do_mailing
|
# curl --verbose --header "Content-type: application/html" --request POST --data "" http://contactorama.dev/birthdays/do_mailing
|
||||||
# wget --post-data '' http://contact-o-rama.de/birthdays/do_mailing
|
# wget --post-data '' http://contact-o-rama.de/birthdays/do_mailing
|
||||||
# crontab:
|
# crontab:
|
||||||
# 30 3 * * * wget --post-data '' http://contact-o-rama.de/birthdays/do_mailing
|
# 30 3 * * * wget --post-data '' http://contact-o-rama.de/birthdays/do_mailing
|
||||||
def do_mailing
|
def do_mailing
|
||||||
birthdays = get_next_weeks_birthdays
|
birthdays = get_next_weeks_birthdays
|
||||||
birthdays.each do |bday|
|
logger.debug "birthdays.nil? = " + birthdays.nil?.to_s + "......"
|
||||||
logger.info "............< do_mailing: " + bday.firstname + " " + bday.lastname + " >.............."
|
unless birthdays.nil?
|
||||||
UserMailer.next_weeks_birthday_notification(birthdays).deliver
|
logger.debug "..... birthdays: " + birthdays.count.to_s + "......"
|
||||||
|
birthdays.each do |bday|
|
||||||
|
logger.info "............< do_mailing: " + bday.firstname + " " + bday.lastname + " >.............."
|
||||||
|
UserMailer.next_weeks_birthday_notification(birthdays).deliver
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
logger.debug "........... Mailings done (or had none to do)"
|
||||||
|
respond_to do |format|
|
||||||
|
logger.debug ".... rendering...."
|
||||||
|
format.html { render :layout => false }
|
||||||
|
logger.debug ".... rendered ...."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,5 @@ class UserMailer < ActionMailer::Base
|
||||||
logger.debug "----------------< we don't send no email, yet >----------------------"
|
logger.debug "----------------< we don't send no email, yet >----------------------"
|
||||||
@birthday_contacts = birthdays
|
@birthday_contacts = birthdays
|
||||||
mail(:to => "contact-o-rama@gasbottle-county.eu", :subject => "Contact-o-Rama: Geburtstage in den nächsten 7 Tagen.")
|
mail(:to => "contact-o-rama@gasbottle-county.eu", :subject => "Contact-o-Rama: Geburtstage in den nächsten 7 Tagen.")
|
||||||
birthdays.each do |contact|
|
end
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
Done.
|
||||||
|
|
@ -14,6 +14,7 @@ module ContactORama
|
||||||
|
|
||||||
# Custom directories with classes and modules you want to be autoloadable.
|
# Custom directories with classes and modules you want to be autoloadable.
|
||||||
# config.autoload_paths += %W(#{config.root}/extras)
|
# config.autoload_paths += %W(#{config.root}/extras)
|
||||||
|
config.autoload_paths += Dir["#{config.root}/lib", "#{config.root}/lib/**/"]
|
||||||
|
|
||||||
# Only load the plugins named here, in the order given (default is alphabetical).
|
# Only load the plugins named here, in the order given (default is alphabetical).
|
||||||
# :all can be used as a placeholder for all plugins not explicitly named.
|
# :all can be used as a placeholder for all plugins not explicitly named.
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,6 @@ ContactORama::Application.configure do
|
||||||
# Don't care if the mailer can't send
|
# Don't care if the mailer can't send
|
||||||
config.action_mailer.raise_delivery_errors = false
|
config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
config.action_mailer.default_url_options = { :host => 'localhsot:3000' }
|
|
||||||
|
|
||||||
# Print deprecation notices to the Rails logger
|
# Print deprecation notices to the Rails logger
|
||||||
config.active_support.deprecation = :log
|
config.active_support.deprecation = :log
|
||||||
|
|
||||||
|
|
|
||||||
6
lib/development_mail_interceptor.rb
Normal file
6
lib/development_mail_interceptor.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
class DevelopmentMailInterceptor
|
||||||
|
def self.delivering_email(message)
|
||||||
|
message.subject = "#{message.to} #{message.subject}"
|
||||||
|
message.to = "roland@gasbottle-county.eu"
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Add table
Add a link
Reference in a new issue