FogBugz #135: Prepare the Mail-Output for the 2day / 7day birthday reminders.
This commit is contained in:
parent
60f1368c1e
commit
7ed4c0bf6f
3 changed files with 42 additions and 3 deletions
|
|
@ -12,10 +12,11 @@ class BirthdaysController < ApplicationController
|
|||
# crontab:
|
||||
# 30 3 * * * wget --post-data '' http://contact-o-rama.de/birthdays/do_mailing
|
||||
def do_mailing
|
||||
birthdays = get_birthdays_next_7d
|
||||
logger.debug "birthdays.nil? = " + birthdays.nil?.to_s + "......"
|
||||
birthdays_2d = get_birthdays_next_2d
|
||||
birthdays_7d = get_birthdays_next_7d
|
||||
logger.debug "birthdays_2d.nil? = " + birthdays_2d.nil?.to_s + "......"
|
||||
unless birthdays.nil?
|
||||
birthdays_by_email = group_birthdays_by_email(birthdays)
|
||||
birthdays_by_email = group_birthdays_by_email(birthdays_7d)
|
||||
birthdays_by_email.each do |email, bdays|
|
||||
UserMailer.next_weeks_birthday_notification(email, bdays).deliver
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,6 +7,12 @@ class UserMailer < ActionMailer::Base
|
|||
mail(:to => email, :subject => "Contact-o-Rama: Geburtstage in den nächsten 7 Tagen.")
|
||||
end
|
||||
|
||||
def upcoming_birthdays_notification(email, birthdays_2days, birthdays_7days)
|
||||
@birthday_contacts_2days = birthdays_2days
|
||||
@birthday_contacts_2days = birthdays_7days
|
||||
mail(:to => email, :subject => "Contact-o-Rama: anstehende Geburtstage")
|
||||
end
|
||||
|
||||
# obsolete
|
||||
# def next_weeks_birthday_notification(birthdays)
|
||||
# logger.debug "----------------< we don't send no email, yet >----------------------"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
<% unless (@birthday_contacts_2days.blank? && @birthday_contacts_7days.blank?) %>
|
||||
<table width="95%" border="0" cellspacing="0" cellpadding="25">
|
||||
<tr>
|
||||
<th bgcolor="#ed8200" width="100%">
|
||||
<span style="color: #fff">Contact</span><span style="color: #fddfbf">-o-Rama:</span> <span style="color: #fff">anstehende Geburtstage</span>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<% unless @birthday_contacts_2days.blank? %>
|
||||
<h2>Übermorgen, <%= (Date.today + 2).to_s %>:
|
||||
<ul>
|
||||
<% @birthday_contacts_2days.each do |c| %>
|
||||
<li><%= c.firstname %> <%= c.lastname %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<% unless @birthday_contacts_7days.blank? %>
|
||||
<h2>In einer Woche, also am <%= (Date.today + 7).to_s %>:
|
||||
<ul>
|
||||
<% @birthday_contacts_7days.each do |c| %>
|
||||
<li><%= c.firstname %> <%= c.lastname %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<% unless @birthday_contacts_2days.blank? && @birthday_contacts_7days.blank? %>
|
||||
<hr>
|
||||
<p>Passende Kontaktdaten gibt's vielleicht bei <a href="http://ocontact-o-rama.de">Contact-o-Rama</a>.</p>
|
||||
</table>
|
||||
<% end %>
|
||||
Loading…
Add table
Add a link
Reference in a new issue