Description:
update mail functionality. Update syntax for mail gem (we might need more options for mail setting?)
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r348:fc78be8c614c - - 2 files changed: 14 inserted, 3 deleted
@@ -120,37 +120,37 | |||||
|
120 | contest_name = GraderConfiguration['contest.name'] |
|
120 | contest_name = GraderConfiguration['contest.name'] |
|
121 | activation_url = url_for(:action => 'confirm', |
|
121 | activation_url = url_for(:action => 'confirm', |
|
122 | :login => user.login, |
|
122 | :login => user.login, |
|
123 | :activation => user.activation_key) |
|
123 | :activation => user.activation_key) |
|
124 | home_url = url_for(:controller => 'main', :action => 'index') |
|
124 | home_url = url_for(:controller => 'main', :action => 'index') |
|
125 | mail_subject = "[#{contest_name}] Confirmation" |
|
125 | mail_subject = "[#{contest_name}] Confirmation" |
|
126 | mail_body = t('registration.email_body', { |
|
126 | mail_body = t('registration.email_body', { |
|
127 | :full_name => user.full_name, |
|
127 | :full_name => user.full_name, |
|
128 | :contest_name => contest_name, |
|
128 | :contest_name => contest_name, |
|
129 | :login => user.login, |
|
129 | :login => user.login, |
|
130 | :password => user.password, |
|
130 | :password => user.password, |
|
131 | :activation_url => activation_url, |
|
131 | :activation_url => activation_url, |
|
132 | - :admin_email => admin_email |
|
132 | + :admin_email => GraderConfiguration['system.admin_email'] |
|
133 | }) |
|
133 | }) |
|
134 |
|
134 | ||
|
135 | logger.info mail_body |
|
135 | logger.info mail_body |
|
136 |
|
136 | ||
|
137 | send_mail(user.email, mail_subject, mail_body) |
|
137 | send_mail(user.email, mail_subject, mail_body) |
|
138 | end |
|
138 | end |
|
139 |
|
139 | ||
|
140 | def send_new_password_email(user) |
|
140 | def send_new_password_email(user) |
|
141 | contest_name = GraderConfiguration['contest.name'] |
|
141 | contest_name = GraderConfiguration['contest.name'] |
|
142 | mail_subject = "[#{contest_name}] Password recovery" |
|
142 | mail_subject = "[#{contest_name}] Password recovery" |
|
143 | mail_body = t('registration.password_retrieval.email_body', { |
|
143 | mail_body = t('registration.password_retrieval.email_body', { |
|
144 | :full_name => user.full_name, |
|
144 | :full_name => user.full_name, |
|
145 | :contest_name => contest_name, |
|
145 | :contest_name => contest_name, |
|
146 | :login => user.login, |
|
146 | :login => user.login, |
|
147 | :password => user.password, |
|
147 | :password => user.password, |
|
148 | - :admin_email => admin_email |
|
148 | + :admin_email => GraderConfiguration['system.admin_email'] |
|
149 | }) |
|
149 | }) |
|
150 |
|
150 | ||
|
151 | logger.info mail_body |
|
151 | logger.info mail_body |
|
152 |
|
152 | ||
|
153 | send_mail(user.email, mail_subject, mail_body) |
|
153 | send_mail(user.email, mail_subject, mail_body) |
|
154 | end |
|
154 | end |
|
155 |
|
155 | ||
|
156 | end |
|
156 | end |
@@ -13,18 +13,29 | |||||
|
13 | -------------------------- |
|
13 | -------------------------- |
|
14 | " |
|
14 | " |
|
15 | return true |
|
15 | return true |
|
16 | end |
|
16 | end |
|
17 |
|
17 | ||
|
18 | mail = Mail.new do |
|
18 | mail = Mail.new do |
|
19 | from mail_from |
|
19 | from mail_from |
|
20 | to mail_to |
|
20 | to mail_to |
|
21 | subject mail_subject |
|
21 | subject mail_subject |
|
22 | body mail_body |
|
22 | body mail_body |
|
23 | end |
|
23 | end |
|
24 |
|
24 | ||
|
25 | - mail.delivery_settings = { :address => smtp_server } |
|
25 | + mail_option = { |
|
|
26 | + :address => smtp_server, | ||
|
|
27 | + # :domain => nil, | ||
|
|
28 | + # :port => 25, | ||
|
|
29 | + # :user_name => nil, | ||
|
|
30 | + # :password => nil, | ||
|
|
31 | + # :authentication=>'plain', | ||
|
|
32 | + # :enable_starttls_auto => true | ||
|
|
33 | + } | ||
|
|
34 | + | ||
|
|
35 | + mail.delivery_method :smtp, mail_option | ||
|
|
36 | + | ||
|
26 | mail.deliver |
|
37 | mail.deliver |
|
27 | end |
|
38 | end |
|
28 |
|
39 | ||
|
29 | end |
|
40 | end |
|
30 |
|
41 |
You need to be logged in to leave comments.
Login now