Description:
Merge pull request #6 from nattee/master update mail functionality. Update syntax for mail gem (we might need mor...
Commit status:
[Not Reviewed]
References:
merge default
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r361:fae81d234a8a - - 8 files changed: 110 inserted, 4 deleted

@@ -0,0 +1,18
1 +
2 +
3 + = form_tag({action: :user_stat_max }) do
4 + .submitbox
5 + %table
6 + %tr
7 + %td{colspan: 6, style: 'font-weight: bold'} Query maximum score in submission range
8 + %tr
9 + %td{style: 'width: 120px; font-weight: bold'} Submission ID:
10 + %td{align: 'right'} From:
11 + %td= text_field_tag 'since_id', params[:since_id], style: 'width:40px'
12 + %td To:
13 + %td= text_field_tag 'until_id', params[:until_id], style: 'width:40px'
14 + %td= submit_tag 'query'
15 + %tr
16 + %td
17 + %td{colspan: 5} Leave blank for uncondition
18 +
@@ -0,0 +1,44
1 + %h1 User grading results
2 + %h2 Show max scores in submission range
3 +
4 + - if @problem and @problem.errors
5 + =error_messages_for 'problem'
6 +
7 + = render partial: 'submission_range'
8 +
9 + - if @log
10 + %h3 Import log
11 + %pre.import-log
12 + = @log
13 +
14 + %p= link_to '[Show only latest submissions]', controller: :user_admin, action: :user_stat
15 +
16 + %table.info
17 + %thead
18 + %tr.info-head
19 + %th User
20 + %th Name
21 + %th Activated?
22 + %th Logged in
23 + %th Contest(s)
24 + - @problems.each do |p|
25 + %th= p.name
26 + %th Total
27 + %th Passed
28 + %tbody
29 + - @scorearray.each do |sc|
30 + %tr{class: cycle('info-even','info-odd')}
31 + - total,num_passed = 0,0
32 + - sc.each_index do |i|
33 + - if i == 0
34 + %td= sc[i].login
35 + %td= sc[i].full_name
36 + %td= sc[i].activated
37 + %td= sc[i].try(:contest_stat).try(:started_at)!=nil ? 'yes' : 'no'
38 + %td= sc[i].contests.collect {|c| c.name}.join(', ')
39 + - else
40 + %td= sc[i][0]
41 + - total += sc[i][0]
42 + - num_passed += 1 if sc[i][1]
43 + %td= total
44 + %td= num_passed
@@ -47,192 +47,213
47 47
48 48 def new
49 49 @user = User.new
50 50 end
51 51
52 52 def create
53 53 @user = User.new(params[:user])
54 54 @user.activated = true
55 55 if @user.save
56 56 flash[:notice] = 'User was successfully created.'
57 57 redirect_to :action => 'list'
58 58 else
59 59 render :action => 'new'
60 60 end
61 61 end
62 62
63 63 def create_from_list
64 64 lines = params[:user_list]
65 65
66 66 note = []
67 67
68 68 lines.split("\n").each do |line|
69 69 items = line.chomp.split(',')
70 70 if items.length>=2
71 71 login = items[0]
72 72 full_name = items[1]
73 73
74 74 added_random_password = false
75 75 if items.length>=3
76 76 password = items[2].chomp(" ")
77 77 user_alias = (items.length>=4) ? items[3] : login
78 78 else
79 79 password = random_password
80 80 user_alias = (items.length>=4) ? items[3] : login
81 81 added_random_password = true
82 82 end
83 83
84 84 user = User.new({:login => login,
85 85 :full_name => full_name,
86 86 :password => password,
87 87 :password_confirmation => password,
88 88 :alias => user_alias})
89 89 user.activated = true
90 90 user.save
91 91
92 92 if added_random_password
93 93 note << "'#{login}' (+)"
94 94 else
95 95 note << login
96 96 end
97 97 end
98 98 end
99 99 flash[:notice] = 'User(s) ' + note.join(', ') +
100 100 ' were successfully created. ' +
101 101 '( (+) - created with random passwords.)'
102 102 redirect_to :action => 'list'
103 103 end
104 104
105 105 def edit
106 106 @user = User.find(params[:id])
107 107 end
108 108
109 109 def update
110 110 @user = User.find(params[:id])
111 111 if @user.update_attributes(params[:user])
112 112 flash[:notice] = 'User was successfully updated.'
113 113 redirect_to :action => 'show', :id => @user
114 114 else
115 115 render :action => 'edit'
116 116 end
117 117 end
118 118
119 119 def destroy
120 120 User.find(params[:id]).destroy
121 121 redirect_to :action => 'list'
122 122 end
123 123
124 124 def user_stat
125 125 @problems = Problem.find_available_problems
126 126 @users = User.find(:all, :include => [:contests, :contest_stat])
127 127 @scorearray = Array.new
128 128 @users.each do |u|
129 129 ustat = Array.new
130 130 ustat[0] = u
131 131 @problems.each do |p|
132 132 sub = Submission.find_last_by_user_and_problem(u.id,p.id)
133 133 if (sub!=nil) and (sub.points!=nil)
134 134 ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)]
135 135 else
136 136 ustat << [0,false]
137 137 end
138 138 end
139 139 @scorearray << ustat
140 140 end
141 141 end
142 142
143 + def user_stat_max
144 + @problems = Problem.find_available_problems
145 + @users = User.find(:all, :include => [:contests, :contest_stat])
146 + @scorearray = Array.new
147 + #set up range from param
148 + since_id = params.fetch(:since_id, 0).to_i
149 + until_id = params.fetch(:until_id, 0).to_i
150 + @users.each do |u|
151 + ustat = Array.new
152 + ustat[0] = u
153 + @problems.each do |p|
154 + max_points = 0
155 + Submission.find_in_range_by_user_and_problem(u.id,p.id,since_id,until_id).each do |sub|
156 + max_points = sub.points if sub and sub.points and (sub.points > max_points)
157 + end
158 + ustat << [(max_points.to_f*100/p.full_score).round, (max_points>=p.full_score)]
159 + end
160 + @scorearray << ustat
161 + end
162 + end
163 +
143 164 def import
144 165 if params[:file]==''
145 166 flash[:notice] = 'Error importing no file'
146 167 redirect_to :action => 'list' and return
147 168 end
148 169 import_from_file(params[:file])
149 170 end
150 171
151 172 def random_all_passwords
152 173 users = User.find(:all)
153 174 @prefix = params[:prefix] || ''
154 175 @non_admin_users = User.find_non_admin_with_prefix(@prefix)
155 176 @changed = false
156 177 if request.request_method == 'POST'
157 178 @non_admin_users.each do |user|
158 179 password = random_password
159 180 user.password = password
160 181 user.password_confirmation = password
161 182 user.save
162 183 end
163 184 @changed = true
164 185 end
165 186 end
166 187
167 188 # contest management
168 189
169 190 def contests
170 191 @contest, @users = find_contest_and_user_from_contest_id(params[:id])
171 192 @contests = Contest.enabled
172 193 end
173 194
174 195 def assign_from_list
175 196 contest_id = params[:users_contest_id]
176 197 org_contest, users = find_contest_and_user_from_contest_id(contest_id)
177 198 contest = Contest.find(params[:new_contest][:id])
178 199 if !contest
179 200 flash[:notice] = 'Error: no contest'
180 201 redirect_to :action => 'contests', :id =>contest_id
181 202 end
182 203
183 204 note = []
184 205 users.each do |u|
185 206 u.contests = [contest]
186 207 note << u.login
187 208 end
188 209 flash[:notice] = 'User(s) ' + note.join(', ') +
189 210 " were successfully reassigned to #{contest.title}."
190 211 redirect_to :action => 'contests', :id =>contest.id
191 212 end
192 213
193 214 def add_to_contest
194 215 user = User.find(params[:id])
195 216 contest = Contest.find(params[:contest_id])
196 217 if user and contest
197 218 user.contests << contest
198 219 end
199 220 redirect_to :action => 'list'
200 221 end
201 222
202 223 def remove_from_contest
203 224 user = User.find(params[:id])
204 225 contest = Contest.find(params[:contest_id])
205 226 if user and contest
206 227 user.contests.delete(contest)
207 228 end
208 229 redirect_to :action => 'list'
209 230 end
210 231
211 232 def contest_management
212 233 end
213 234
214 235 def manage_contest
215 236 contest = Contest.find(params[:contest][:id])
216 237 if !contest
217 238 flash[:notice] = 'You did not choose the contest.'
218 239 redirect_to :action => 'contest_management' and return
219 240 end
220 241
221 242 operation = params[:operation]
222 243
223 244 if not ['add','remove','assign'].include? operation
224 245 flash[:notice] = 'You did not choose the operation to perform.'
225 246 redirect_to :action => 'contest_management' and return
226 247 end
227 248
228 249 lines = params[:login_list]
229 250 if !lines or lines.blank?
230 251 flash[:notice] = 'You entered an empty list.'
231 252 redirect_to :action => 'contest_management' and return
232 253 end
233 254
234 255 note = []
235 256 users = []
236 257 lines.split("\n").each do |line|
237 258 user = User.find_by_login(line.chomp)
238 259 if user
@@ -36,121 +36,121
36 36 if user.save
37 37 flash[:notice] = 'password changed'
38 38 else
39 39 flash[:notice] = 'Error: password changing failed'
40 40 end
41 41 redirect_to :action => 'index'
42 42 end
43 43
44 44 def new
45 45 @user = User.new
46 46 render :action => 'new', :layout => 'empty'
47 47 end
48 48
49 49 def register
50 50 if(params[:cancel])
51 51 redirect_to :controller => 'main', :action => 'login'
52 52 return
53 53 end
54 54 @user = User.new(params[:user])
55 55 @user.password_confirmation = @user.password = User.random_password
56 56 @user.activated = false
57 57 if (@user.valid?) and (@user.save)
58 58 if send_confirmation_email(@user)
59 59 render :action => 'new_splash', :layout => 'empty'
60 60 else
61 61 @admin_email = GraderConfiguration['system.admin_email']
62 62 render :action => 'email_error', :layout => 'empty'
63 63 end
64 64 else
65 65 @user.errors.add(:base,"Email cannot be blank") if @user.email==''
66 66 render :action => 'new', :layout => 'empty'
67 67 end
68 68 end
69 69
70 70 def confirm
71 71 login = params[:login]
72 72 key = params[:activation]
73 73 @user = User.find_by_login(login)
74 74 if (@user) and (@user.verify_activation_key(key))
75 75 if @user.valid? # check uniquenss of email
76 76 @user.activated = true
77 77 @user.save
78 78 @result = :successful
79 79 else
80 80 @result = :email_used
81 81 end
82 82 else
83 83 @result = :failed
84 84 end
85 85 render :action => 'confirm', :layout => 'empty'
86 86 end
87 87
88 88 def forget
89 89 render :action => 'forget', :layout => 'empty'
90 90 end
91 91
92 92 def retrieve_password
93 93 email = params[:email]
94 94 user = User.find_by_email(email)
95 95 if user
96 96 last_updated_time = user.updated_at || user.created_at || (Time.now.gmtime - 1.hour)
97 97 if last_updated_time > Time.now.gmtime - 5.minutes
98 98 flash[:notice] = 'The account has recently created or new password has recently been requested. Please wait for 5 minutes'
99 99 else
100 100 user.password = user.password_confirmation = User.random_password
101 101 user.save
102 102 send_new_password_email(user)
103 103 flash[:notice] = 'New password has been mailed to you.'
104 104 end
105 105 else
106 106 flash[:notice] = I18n.t 'registration.password_retrieval.no_email'
107 107 end
108 108 redirect_to :action => 'forget'
109 109 end
110 110
111 111 protected
112 112
113 113 def verify_online_registration
114 114 if !GraderConfiguration['system.online_registration']
115 115 redirect_to :controller => 'main', :action => 'login'
116 116 end
117 117 end
118 118
119 119 def send_confirmation_email(user)
120 120 contest_name = GraderConfiguration['contest.name']
121 121 activation_url = url_for(:action => 'confirm',
122 122 :login => user.login,
123 123 :activation => user.activation_key)
124 124 home_url = url_for(:controller => 'main', :action => 'index')
125 125 mail_subject = "[#{contest_name}] Confirmation"
126 126 mail_body = t('registration.email_body', {
127 127 :full_name => user.full_name,
128 128 :contest_name => contest_name,
129 129 :login => user.login,
130 130 :password => user.password,
131 131 :activation_url => activation_url,
132 - :admin_email => admin_email
132 + :admin_email => GraderConfiguration['system.admin_email']
133 133 })
134 134
135 135 logger.info mail_body
136 136
137 137 send_mail(user.email, mail_subject, mail_body)
138 138 end
139 139
140 140 def send_new_password_email(user)
141 141 contest_name = GraderConfiguration['contest.name']
142 142 mail_subject = "[#{contest_name}] Password recovery"
143 143 mail_body = t('registration.password_retrieval.email_body', {
144 144 :full_name => user.full_name,
145 145 :contest_name => contest_name,
146 146 :login => user.login,
147 147 :password => user.password,
148 - :admin_email => admin_email
148 + :admin_email => GraderConfiguration['system.admin_email']
149 149 })
150 150
151 151 logger.info mail_body
152 152
153 153 send_mail(user.email, mail_subject, mail_body)
154 154 end
155 155
156 156 end
@@ -20,114 +20,114
20 20 menu_items << "<br/>"
21 21 end
22 22
23 23 # main page
24 24 append_to menu_items, "[#{I18n.t 'menu.main'}]", 'main', 'list'
25 25 append_to menu_items, "[#{I18n.t 'menu.messages'}]", 'messages', 'list'
26 26
27 27 if (user!=nil) and (GraderConfiguration.show_tasks_to?(user))
28 28 append_to menu_items, "[#{I18n.t 'menu.tasks'}]", 'tasks', 'list'
29 29 append_to menu_items, "[#{I18n.t 'menu.submissions'}]", 'main', 'submission'
30 30 append_to menu_items, "[#{I18n.t 'menu.test'}]", 'test', 'index'
31 31 end
32 32 append_to menu_items, "[#{I18n.t 'menu.help'}]", 'main', 'help'
33 33
34 34 if GraderConfiguration['system.user_setting_enabled']
35 35 append_to menu_items, "[#{I18n.t 'menu.settings'}]", 'users', 'index'
36 36 end
37 37 append_to menu_items, "[#{I18n.t 'menu.log_out'}]", 'main', 'login'
38 38
39 39 menu_items.html_safe
40 40 end
41 41
42 42 def append_to(option,label, controller, action)
43 43 option << ' ' if option!=''
44 44 option << link_to_unless_current(label,
45 45 :controller => controller,
46 46 :action => action)
47 47 end
48 48
49 49 def format_short_time(time)
50 50 now = Time.now.gmtime
51 51 st = ''
52 52 if (time.yday != now.yday) or
53 53 (time.year != now.year)
54 54 st = time.strftime("%x ")
55 55 end
56 56 st + time.strftime("%X")
57 57 end
58 58
59 59 def format_short_duration(duration)
60 60 return '' if duration==nil
61 61 d = duration.to_f
62 62 return Time.at(d).gmtime.strftime("%X")
63 63 end
64 64
65 65 def read_textfile(fname,max_size=2048)
66 66 begin
67 67 File.open(fname).read(max_size)
68 68 rescue
69 69 nil
70 70 end
71 71 end
72 72
73 73 def user_title_bar(user)
74 74 header = ''
75 75 time_left = ''
76 76
77 77 #
78 78 # if the contest is over
79 79 if GraderConfiguration.time_limit_mode?
80 80 if user.contest_finished?
81 81 header = <<CONTEST_OVER
82 82 <tr><td colspan="2" align="center">
83 83 <span class="contest-over-msg">THE CONTEST IS OVER</span>
84 84 </td></tr>
85 85 CONTEST_OVER
86 86 end
87 87 if !user.contest_started?
88 88 time_left = "&nbsp;&nbsp;" + (t 'title_bar.contest_not_started')
89 89 else
90 90 time_left = "&nbsp;&nbsp;" + (t 'title_bar.remaining_time') +
91 91 " #{format_short_duration(user.contest_time_left)}"
92 92 end
93 93 end
94 94
95 95 #
96 96 # if the contest is in the anaysis mode
97 97 if GraderConfiguration.analysis_mode?
98 98 header = <<ANALYSISMODE
99 99 <tr><td colspan="2" align="center">
100 100 <span class="contest-over-msg">ANALYSIS MODE</span>
101 101 </td></tr>
102 102 ANALYSISMODE
103 103 end
104 104
105 105 contest_name = GraderConfiguration['contest.name']
106 106
107 107 #
108 108 # build real title bar
109 109 result = <<TITLEBAR
110 110 <div class="title">
111 111 <table>
112 112 #{header}
113 113 <tr>
114 114 <td class="left-col">
115 115 #{user.full_name}<br/>
116 - #{t 'title_bar.current_time'} #{format_short_time(Time.new)}
116 + #{t 'title_bar.current_time'} #{format_short_time(Time.zone.now)}
117 117 #{time_left}
118 118 <br/>
119 119 </td>
120 120 <td class="right-col">#{contest_name}</td>
121 121 </tr>
122 122 </table>
123 123 </div>
124 124 TITLEBAR
125 125 result.html_safe
126 126 end
127 127
128 128 def markdown(text)
129 129 markdown = RDiscount.new(text)
130 130 markdown.to_html.html_safe
131 131 end
132 132
133 133 end
@@ -1,132 +1,139
1 1 class Submission < ActiveRecord::Base
2 2
3 3 belongs_to :language
4 4 belongs_to :problem
5 5 belongs_to :user
6 6
7 7 before_validation :assign_problem
8 8 before_validation :assign_language
9 9
10 10 validates_presence_of :source
11 11 validates_length_of :source, :maximum => 100_000, :allow_blank => true, :message => 'too long'
12 12 validates_length_of :source, :minimum => 1, :allow_blank => true, :message => 'too short'
13 13 validate :must_have_valid_problem
14 14 validate :must_specify_language
15 15
16 16 before_save :assign_latest_number_if_new_recond
17 17
18 18 def self.find_last_by_user_and_problem(user_id, problem_id)
19 19 last_sub = find(:first,
20 20 :conditions => {:user_id => user_id,
21 21 :problem_id => problem_id},
22 22 :order => 'number DESC')
23 23 return last_sub
24 24 end
25 25
26 26 def self.find_all_last_by_problem(problem_id)
27 27 # need to put in SQL command, maybe there's a better way
28 28 Submission.find_by_sql("SELECT * FROM submissions " +
29 29 "WHERE id = " +
30 30 "(SELECT MAX(id) FROM submissions AS subs " +
31 31 "WHERE subs.user_id = submissions.user_id AND " +
32 32 "problem_id = " + problem_id.to_s + " " +
33 33 "GROUP BY user_id) " +
34 34 "ORDER BY user_id")
35 35 end
36 36
37 + def self.find_in_range_by_user_and_problem(user_id, problem_id,since_id,until_id)
38 + records = Submission.where(problem_id: problem_id,user_id: user_id)
39 + records = records.where('id >= ?',since_id) if since_id > 0
40 + records = records.where('id <= ?',until_id) if until_id > 0
41 + records.all
42 + end
43 +
37 44 def self.find_last_for_all_available_problems(user_id)
38 45 submissions = Array.new
39 46 problems = Problem.find_available_problems
40 47 problems.each do |problem|
41 48 sub = Submission.find_last_by_user_and_problem(user_id, problem.id)
42 49 submissions << sub if sub!=nil
43 50 end
44 51 submissions
45 52 end
46 53
47 54 def self.find_by_user_problem_number(user_id, problem_id, number)
48 55 Submission.find(:first,
49 56 :conditions => {
50 57 :user_id => user_id,
51 58 :problem_id => problem_id,
52 59 :number => number
53 60 })
54 61 end
55 62
56 63 def self.find_all_by_user_problem(user_id, problem_id)
57 64 Submission.find(:all,
58 65 :conditions => {
59 66 :user_id => user_id,
60 67 :problem_id => problem_id,
61 68 })
62 69 end
63 70
64 71 def download_filename
65 72 if self.problem.output_only
66 73 return self.source_filename
67 74 else
68 75 timestamp = self.submitted_at.localtime.strftime("%H%M%S")
69 76 return "#{self.problem.name}-#{timestamp}.#{self.language.ext}"
70 77 end
71 78 end
72 79
73 80 protected
74 81
75 82 def self.find_option_in_source(option, source)
76 83 if source==nil
77 84 return nil
78 85 end
79 86 i = 0
80 87 source.each_line do |s|
81 88 if s =~ option
82 89 words = s.split
83 90 return words[1]
84 91 end
85 92 i = i + 1
86 93 if i==10
87 94 return nil
88 95 end
89 96 end
90 97 return nil
91 98 end
92 99
93 100 def self.find_language_in_source(source, source_filename="")
94 101 langopt = find_option_in_source(/^LANG:/,source)
95 102 if langopt
96 103 return (Language.find_by_name(langopt) ||
97 104 Language.find_by_pretty_name(langopt))
98 105 else
99 106 if source_filename
100 107 return Language.find_by_extension(source_filename.split('.').last)
101 108 else
102 109 return nil
103 110 end
104 111 end
105 112 end
106 113
107 114 def self.find_problem_in_source(source, source_filename="")
108 115 prob_opt = find_option_in_source(/^TASK:/,source)
109 116 if problem = Problem.find_by_name(prob_opt)
110 117 return problem
111 118 else
112 119 if source_filename
113 120 return Problem.find_by_name(source_filename.split('.').first)
114 121 else
115 122 return nil
116 123 end
117 124 end
118 125 end
119 126
120 127 def assign_problem
121 128 if self.problem_id!=-1
122 129 begin
123 130 self.problem = Problem.find(self.problem_id)
124 131 rescue ActiveRecord::RecordNotFound
125 132 self.problem = nil
126 133 end
127 134 else
128 135 self.problem = Submission.find_problem_in_source(self.source,
129 136 self.source_filename)
130 137 end
131 138 end
132 139
@@ -1,43 +1,48
1 1 <h1>User grading results</h1>
2 + <h2>Show scores from latest submission</h2>
3 +
4 + <%= render 'submission_range' %>
5 +
6 + <p>Latest scores</p>
2 7
3 8 <table class="info">
4 9 <tr class="info-head">
5 10 <th>User</th>
6 11 <th>Name</th>
7 12 <th>Activated?</th>
8 13 <th>Logged in</th>
9 14 <th>Contest(s)</th>
10 15 <% @problems.each do |p| %>
11 16 <th><%= p.name %></th>
12 17 <% end %>
13 18 <th>Total</th>
14 19 <th>Passed</th>
15 20 </tr>
16 21 <% counter = 0 %>
17 22 <% @scorearray.each do |sc| %>
18 23 <tr class="<%= (counter %2 ==0) ? "info-even" : "info-odd" %>">
19 24 <% total = 0 %>
20 25 <% num_passed = 0 %>
21 26 <% sc.each_index do |i| %>
22 27 <% if i==0 %>
23 28 <td><%= sc[i].login %></td>
24 29 <td><%= sc[i].full_name %></td>
25 30 <td><%= sc[i].activated %></td>
26 31 <td>
27 32 <%= sc[i].try(:contest_stat).try(:started_at)!=nil ? 'yes' : 'no' %>
28 33 </td>
29 34 <td>
30 35 <%= sc[i].contests.collect {|c| c.name}.join(', ') %>
31 36 </td>
32 37 <% else %>
33 38 <td><%= sc[i][0] %></td>
34 39 <% total += sc[i][0] %>
35 40 <% num_passed += 1 if sc[i][1] %>
36 41 <% end %>
37 42 <% end %>
38 43 <td><%= total %></td>
39 44 <td><%= num_passed %></td>
40 45 </tr>
41 46 <% counter += 1 %>
42 47 <% end %>
43 48 </table>
@@ -1,30 +1,41
1 1 module MailHelperMethods
2 2
3 3 def send_mail(mail_to, mail_subject, mail_body)
4 4 mail_from = GraderConfiguration['system.online_registration.from']
5 5 smtp_server = GraderConfiguration['system.online_registration.smtp']
6 6
7 7 if ['fake', 'debug'].include? smtp_server
8 8 puts "-------------------------
9 9 To: #{mail_to}
10 10 From: #{mail_from}
11 11 Subject: #{mail_subject}
12 12 #{mail_body}
13 13 --------------------------
14 14 "
15 15 return true
16 16 end
17 17
18 18 mail = Mail.new do
19 19 from mail_from
20 20 to mail_to
21 21 subject mail_subject
22 22 body mail_body
23 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 37 mail.deliver
27 38 end
28 39
29 40 end
30 41
You need to be logged in to leave comments. Login now