Fix system-email page and ActionMailer configuration, now gmail is working fine

This commit is contained in:
Manson Wang 2014-02-05 18:06:23 +08:00
parent ab94c79fdb
commit 822c23e841
3 changed files with 23 additions and 31 deletions

View File

@ -2,28 +2,30 @@ class CronMail < ActionMailer::Base
default :from => "orbit_test@rulingcom.com" default :from => "orbit_test@rulingcom.com"
def get_settings def get_settings
# @@smtp_settings = { @site = Site.first
# :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 = { @@smtp_settings = {
:address => @site['mail_settings']['address'], :enable_starttls_auto => @site['site_settings']['enable_starttls_auto'],
:port => @site['mail_settings']['port'], :address => @site['site_settings']['address'],
:domain => @site['mail_settings']['domain'], :port => @site['site_settings']['port'],
:authentication => @site['mail_settings']['authentication'], :domain => @site['site_settings']['domain'],
:user_name => @site['mail_settings']['user_name'], :authentication => @site['site_settings']['authentication'],
:password => @site['mail_settings']['password'], :user_name => @site['site_settings']['user_name'],
:tls => @site['mail_settings']['tls'], :password => @site['site_settings']['password']
:enable_starttls_auto => @site['mail_settings']['enable_starttls_auto']
} }
end end
def self.smtp_settings
@site = Site.first
@@smtp_settings = {
:enable_starttls_auto => @site['site_settings']['enable_starttls_auto'],
:address => @site['site_settings']['address'],
:port => @site['site_settings']['port'],
:domain => @site['site_settings']['domain'],
:authentication => @site['site_settings']['authentication'],
:user_name => @site['site_settings']['user_name'],
:password => @site['site_settings']['password']
}
end
def time_check(msg) def time_check(msg)
get_settings get_settings

View File

@ -65,7 +65,7 @@
<div class="control-group"> <div class="control-group">
<label class="control-label muted"><%= t 'mail.domain' %></label> <label class="control-label muted"><%= t 'mail.domain' %></label>
<div class="controls"> <div class="controls">
<%= f.text_field :port, :value => (@site['site_settings']['port'] rescue nil), :class=>"input-large", :placeholder=>"Domain" %> <%= f.text_field :domain, :value => (@site['site_settings']['domain'] rescue nil), :class=>"input-large", :placeholder=>"Domain" %>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
@ -83,7 +83,7 @@
<div class="control-group"> <div class="control-group">
<label class="control-label muted"><%= t 'mail.password' %></label> <label class="control-label muted"><%= t 'mail.password' %></label>
<div class="controls"> <div class="controls">
<%= f.text_field :password, :value => (@site['site_settings']['password'] rescue nil), :class=>"input-large", :placeholder=>"Password" %> <%= f.password_field :password, :value => (@site['site_settings']['password'] rescue nil), :class=>"input-large", :placeholder=>"Password" %>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">

View File

@ -63,15 +63,5 @@ Orbit::Application.configure do
config.action_mailer.delivery_method = :smtp config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true config.action_mailer.raise_delivery_errors = true
config.action_mailer.smtp_settings = {
:enable_starttls_auto => true,
:openssl_verify_mode => 'none',
:address => 'smtp.sendgrid.net',
:port => '587',
:domain => "new.tp.rulingcom.com",
:authentication => "plain",
:user_name => "rulingcom",
:password => "bjo4xjp6"
}
end end