FogBugz #118: try hard(er) to send mail to correct mail address.

This commit is contained in:
Roland Jesse 2012-02-06 23:37:16 +01:00
parent 6cb1bc154c
commit 8b1bc2ae52
2 changed files with 18 additions and 9 deletions

View file

@ -15,12 +15,15 @@ class BirthdaysController < ApplicationController
logger.debug "birthdays.nil? = " + birthdays.nil?.to_s + "......"
unless birthdays.nil?
birthdays_by_email = group_birthdays_by_email(birthdays)
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
birthdays_by_email.each do |email, bdays|
UserMailer.next_weeks_birthday_notification(email, bdays).deliver
end
# 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)"

View file

@ -2,9 +2,15 @@
class UserMailer < ActionMailer::Base
default :from => "info@contact-o-rama.com"
def next_weeks_birthday_notification(birthdays)
logger.debug "----------------< we don't send no email, yet >----------------------"
def next_weeks_birthday_notification(email, birthdays)
@birthday_contacts = birthdays
mail(:to => "contact-o-rama@gasbottle-county.eu", :subject => "Contact-o-Rama: Geburtstage in den nächsten 7 Tagen.")
end
mail(:to => email, :subject => "Contact-o-Rama: Geburtstage in den nächsten 7 Tagen.")
end
# obsolete
# def next_weeks_birthday_notification(birthdays)
# 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.")
# end
end