Show More
Commit Description:
submission report
Commit Description:
submission report
References:
File last commit:
Show/Diff file:
Action:
lib/mail_helper_methods.rb
| 41 lines
| 847 B
| text/x-ruby
| RubyLexer
|
|
r296 | module MailHelperMethods | ||
|
r336 | def send_mail(mail_to, mail_subject, mail_body) | ||
mail_from = GraderConfiguration['system.online_registration.from'] | ||||
smtp_server = GraderConfiguration['system.online_registration.smtp'] | ||||
|
r296 | |||
if ['fake', 'debug'].include? smtp_server | ||||
puts "------------------------- | ||||
|
r336 | To: #{mail_to} | ||
From: #{mail_from} | ||||
Subject: #{mail_subject} | ||||
#{mail_body} | ||||
|
r296 | -------------------------- | ||
" | ||||
return true | ||||
end | ||||
|
r336 | mail = Mail.new do | ||
from mail_from | ||||
to mail_to | ||||
subject mail_subject | ||||
body mail_body | ||||
|
r296 | end | ||
r348 | mail_option = { | |||
:address => smtp_server, | ||||
# :domain => nil, | ||||
# :port => 25, | ||||
# :user_name => nil, | ||||
# :password => nil, | ||||
# :authentication=>'plain', | ||||
# :enable_starttls_auto => true | ||||
} | ||||
mail.delivery_method :smtp, mail_option | ||||
|
r336 | mail.deliver | ||
|
r296 | end | ||
end | ||||