Add mail_settings

This commit is contained in:
Christophe Vilayphiou 2012-05-09 11:38:29 +08:00
parent b3be210ff7
commit 41c0c26330
4 changed files with 56 additions and 12 deletions

View File

@ -1,8 +1,33 @@
class CronMail < ActionMailer::Base
default :from => "orbit_test@rulingcom.com"
def get_settings
# @@smtp_settings = {
# :address => "smtp.gmail.com",
# :port => '587',
# :domain => "smtp.gmail.com",
# :authentication => "plain",
# :user_name => "redmine@rulingcom.com",
# :password => "rulingredmine",
# :tls => true,
# :enable_starttls_auto => true
# }
@@smtp_settings = {
:address => @site['mail_settings']['address'],
:port => @site['mail_settings']['port'],
:domain => @site['mail_settings']['domain'],
:authentication => @site['mail_settings']['authentication'],
:user_name => @site['mail_settings']['user_name'],
:password => @site['mail_settings']['password'],
:tls => @site['mail_settings']['tls'],
:enable_starttls_auto => @site['mail_settings']['enable_starttls_auto']
}
end
def time_check(msg)
get_settings
#attachments["rails.png"] = File.read("#{Rails.root}/public/images/rails.png")
mail(:to => "Matt <matt@rulingcom.com>", :subject => msg)
mail(:to => "Chris <chris@rulingcom.com>", :subject => msg)
end
end

View File

@ -13,6 +13,8 @@ class Site
field :public_key, :type => Binary
field :title_always_on, :type => Boolean, :default => false
field :mail_settings, :type => Hash
field :school
field :department

View File

@ -2,4 +2,21 @@
<%= render 'side_bar' %>
<% end %>
mail_setting.html.erb
<div id="poststuff">
<%= form_for @site, :url => admin_site_path(@site), :html => {:class => "clear"} do |f| %>
<%= f.fields_for :site_settings, @site['site_settings'] do |f| %>
address: <%= f.text_field :address, :value => @site['site_settings']['address'] %>
port: <%= f.text_field :port, :value => @site['site_settings']['port'] %>
domain: <%= f.text_field :domain, :value => @site['site_settings']['domain'] %>
authentication: <%= f.text_field :authentication, :value => @site['site_settings']['authentication'] %>
user_name: <%= f.text_field :user_name, :value => @site['site_settings']['user_name'] %>
password: <%= f.text_field :password, :value => @site['site_settings']['password'] %>
tls: <%= f.check_box :tls, :checked => @site['site_settings']['tls'].eql?('1') %>
enable_starttls_auto: <%= f.check_box 'enable_starttls_auto', :checked => @site['site_settings']['enable_starttls_auto'].eql?('1') %>
<% end %>
<div class="form-actions">
<%= f.submit t("submit"), :class => "btn btn-primary" %>
<%= f.submit t("cancel"), :class => "btn ", :type => 'reset' %>
</div>
<% end %>
</div>

View File

@ -29,16 +29,16 @@ Orbit::Application.configure do
# :sender_address => %{"notifier" <redmine@rulingcom.com>},
# :exception_recipients => %w{chris@rulingcom.com}
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:tls => true,
:enable_starttls_auto => true,
:address => "smtp.gmail.com",
:port => '587',
:domain => "smtp.gmail.com",
:authentication => "plain",
:user_name => "redmine@rulingcom.com",
:password => "rulingredmine" }
# config.action_mailer.delivery_method = :smtp
# config.action_mailer.smtp_settings = {
# :tls => true,
# :enable_starttls_auto => true,
# :address => "smtp.gmail.com",
# :port => '587',
# :domain => "smtp.gmail.com",
# :authentication => "plain",
# :user_name => "redmine@rulingcom.com",
# :password => "rulingredmine" }
end