FogBugz #75: actually try to send some mail.

This commit is contained in:
Roland Jesse 2012-01-15 21:28:46 +01:00
parent b50799e81d
commit f89c1f1666
6 changed files with 24 additions and 10 deletions

View file

@ -6,18 +6,29 @@ class BirthdaysController < ApplicationController
@birthdays = get_next_weeks_birthdays
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
# crontab:
# 30 3 * * * wget --post-data '' http://contact-o-rama.de/birthdays/do_mailing
def do_mailing
birthdays = get_next_weeks_birthdays
logger.debug "birthdays.nil? = " + birthdays.nil?.to_s + "......"
unless birthdays.nil?
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
private
def get_next_weeks_birthdays

View file

@ -6,8 +6,5 @@ class UserMailer < ActionMailer::Base
logger.debug "----------------< we don't send no email, yet >----------------------"
@birthday_contacts = birthdays
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

View file

@ -0,0 +1 @@
Done.

View file

@ -14,6 +14,7 @@ module ContactORama
# Custom directories with classes and modules you want to be autoloadable.
# 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).
# :all can be used as a placeholder for all plugins not explicitly named.

View file

@ -17,8 +17,6 @@ ContactORama::Application.configure do
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
config.action_mailer.default_url_options = { :host => 'localhsot:3000' }
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log

View 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