1 class Notifier < ActionMailer::Base
2 def signup_confirm(user, token)
4 from "webmaster@openstreetmap.org"
5 subject "[OpenStreetMap] Confirm your email address"
6 headers "Auto-Submitted" => "auto-generated"
7 body :url => url_for(:host => SERVER_URL,
8 :controller => "user", :action => "confirm",
9 :confirm_string => token.token)
12 def lost_password(user, token)
14 from "webmaster@openstreetmap.org"
15 subject "[OpenStreetMap] Password reset request"
16 headers "Auto-Submitted" => "auto-generated"
17 body :url => url_for(:host => SERVER_URL,
18 :controller => "user", :action => "reset_password",
19 :email => user.email, :token => token.token)
22 def reset_password(user, pass)
24 from "webmaster@openstreetmap.org"
25 subject "[OpenStreetMap] Password reset"
26 headers "Auto-Submitted" => "auto-generated"
30 def gpx_success(trace, possible_points)
31 recipients trace.user.email
32 from "webmaster@openstreetmap.org"
33 subject "[OpenStreetMap] GPX Import success"
34 headers "Auto-Submitted" => "auto-generated"
35 body :trace_name => trace.name,
36 :trace_points => trace.size,
37 :possible_points => possible_points
40 def gpx_failure(trace, error)
41 recipients trace.user.email
42 from "webmaster@openstreetmap.org"
43 subject "[OpenStreetMap] GPX Import failure"
44 headers "Auto-Submitted" => "auto-generated"
45 body :trace_name => trace.name,
49 def message_notification(message)
50 recipients message.recipient.email
51 from "webmaster@openstreetmap.org"
52 subject "[OpenStreetMap] #{message.sender.display_name} sent you a new message"
53 headers "Auto-Submitted" => "auto-generated"
54 body :to_user => message.recipient.display_name,
55 :from_user => message.sender.display_name,
56 :body => message.body,
57 :subject => message.title,
58 :readurl => url_for(:host => SERVER_URL,
59 :controller => "message", :action => "read",
60 :message_id => message.id),
61 :replyurl => url_for(:host => SERVER_URL,
62 :controller => "message", :action => "reply",
63 :message_id => message.id)
66 def diary_comment_notification(comment)
67 recipients comment.diary_entry.user.email
68 from "webmaster@openstreetmap.org"
69 subject "[OpenStreetMap] #{comment.user.display_name} commented on your diary entry"
70 headers "Auto-Submitted" => "auto-generated"
71 body :to_user => comment.diary_entry.user.display_name,
72 :from_user => comment.user.display_name,
73 :body => comment.body,
74 :subject => comment.diary_entry.title,
75 :readurl => url_for(:host => SERVER_URL,
76 :controller => "diary_entry",
78 :display_name => comment.diary_entry.user.display_name,
79 :id => comment.diary_entry.id,
80 :anchor => "comment#{comment.id}"),
81 :commenturl => url_for(:host => SERVER_URL,
82 :controller => "diary_entry",
84 :display_name => comment.diary_entry.user.display_name,
85 :id => comment.diary_entry.id,
86 :anchor => "newcomment"),
87 :replyurl => url_for(:host => SERVER_URL,
88 :controller => "message",
90 :user_id => comment.user.id,
91 :title => "Re: #{comment.diary_entry.title}")
94 def friend_notification(friend)
95 befriender = User.find_by_id(friend.user_id)
96 befriendee = User.find_by_id(friend.friend_user_id)
98 recipients befriendee.email
99 from "webmaster@openstreetmap.org"
100 subject "[OpenStreetMap] #{befriender.display_name} added you as a friend"
101 headers "Auto-Submitted" => "auto-generated"
102 body :user => befriender.display_name,
103 :userurl => url_for(:host => SERVER_URL,
104 :controller => "user", :action => "view",
105 :display_name => befriender.display_name)