1 class Notifier < ActionMailer::Base
2 def signup_confirm(user, token)
4 subject "[OpenStreetMap] Confirm your email address"
5 body :url => url_for(:host => SERVER_URL,
6 :controller => "user", :action => "confirm",
7 :confirm_string => token.token)
10 def email_confirm(user, token)
12 recipients user.new_email
13 subject "[OpenStreetMap] Confirm your email address"
14 body :address => user.new_email,
15 :url => url_for(:host => SERVER_URL,
16 :controller => "user", :action => "confirm_email",
17 :confirm_string => token.token)
20 def lost_password(user, token)
22 subject "[OpenStreetMap] Password reset request"
23 body :url => url_for(:host => SERVER_URL,
24 :controller => "user", :action => "reset_password",
25 :email => user.email, :token => token.token)
28 def reset_password(user, pass)
30 subject "[OpenStreetMap] Password reset"
34 def gpx_success(trace, possible_points)
35 common_headers trace.user
36 subject "[OpenStreetMap] GPX Import success"
37 body :trace_name => trace.name,
38 :trace_points => trace.size,
39 :trace_description => trace.description,
40 :trace_tags => trace.tags,
41 :possible_points => possible_points
44 def gpx_failure(trace, error)
45 common_headers trace.user
46 from "webmaster@openstreetmap.org"
47 subject "[OpenStreetMap] GPX Import failure"
48 body :trace_name => trace.name,
49 :trace_description => trace.description,
50 :trace_tags => trace.tags,
54 def message_notification(message)
55 common_headers message.recipient
56 subject "[OpenStreetMap] #{message.sender.display_name} sent you a new message"
57 body :to_user => message.recipient.display_name,
58 :from_user => message.sender.display_name,
59 :body => message.body,
60 :subject => message.title,
61 :readurl => url_for(:host => SERVER_URL,
62 :controller => "message", :action => "read",
63 :message_id => message.id),
64 :replyurl => url_for(:host => SERVER_URL,
65 :controller => "message", :action => "reply",
66 :message_id => message.id)
69 def diary_comment_notification(comment)
70 common_headers comment.diary_entry.user
71 subject "[OpenStreetMap] #{comment.user.display_name} commented on your diary entry"
72 body :to_user => comment.diary_entry.user.display_name,
73 :from_user => comment.user.display_name,
74 :body => comment.body,
75 :subject => comment.diary_entry.title,
76 :readurl => url_for(:host => SERVER_URL,
77 :controller => "diary_entry",
79 :display_name => comment.diary_entry.user.display_name,
80 :id => comment.diary_entry.id,
81 :anchor => "comment#{comment.id}"),
82 :commenturl => url_for(:host => SERVER_URL,
83 :controller => "diary_entry",
85 :display_name => comment.diary_entry.user.display_name,
86 :id => comment.diary_entry.id,
87 :anchor => "newcomment"),
88 :replyurl => url_for(:host => SERVER_URL,
89 :controller => "message",
91 :user_id => comment.user.id,
92 :title => "Re: #{comment.diary_entry.title}")
95 def friend_notification(friend)
96 befriender = User.find_by_id(friend.user_id)
97 befriendee = User.find_by_id(friend.friend_user_id)
99 common_headers befriendee
100 subject "[OpenStreetMap] #{befriender.display_name} added you as a friend"
101 body :user => befriender.display_name,
102 :userurl => url_for(:host => SERVER_URL,
103 :controller => "user", :action => "view",
104 :display_name => befriender.display_name)
109 def common_headers(recipient)
110 recipients recipient.email
111 from "webmaster@openstreetmap.org"
112 headers "return-path" => "bounces@openstreetmap.org",
113 "Auto-Submitted" => "auto-generated"