Commit d61268e4f15502d46a61ee34f27248194c2f3f53

Authored by Valery Sizov
1 parent a4fbe13f

[#169] – Move email 'from' & 'host' settings to config file

app/mailers/notify.rb
@@ -5,7 +5,7 @@ class Notify < ActionMailer::Base @@ -5,7 +5,7 @@ class Notify < ActionMailer::Base
5 def new_user_email(user, password) 5 def new_user_email(user, password)
6 @user = user 6 @user = user
7 @password = password 7 @password = password
8 - mail(:to => @user.email, :subject => "gitlab | Account was created for you") 8 + mail(:to => @user.email, :subject => "gitlab | Account was created for you", :from => EMAIL_OPTS["from"])
9 end 9 end
10 10
11 def new_issue_email(issue) 11 def new_issue_email(issue)
@@ -13,14 +13,14 @@ class Notify < ActionMailer::Base @@ -13,14 +13,14 @@ class Notify < ActionMailer::Base
13 @project = issue.project 13 @project = issue.project
14 @issue = issue 14 @issue = issue
15 15
16 - mail(:to => @user.email, :subject => "gitlab | New Issue was created") 16 + mail(:to => @user.email, :subject => "gitlab | New Issue was created", :from => EMAIL_OPTS["from"])
17 end 17 end
18 18
19 def note_wall_email(user, note) 19 def note_wall_email(user, note)
20 @user = user 20 @user = user
21 @note = note 21 @note = note
22 @project = note.project 22 @project = note.project
23 - mail(:to => @user.email, :subject => "gitlab | #{@note.project.name} ") 23 + mail(:to => @user.email, :subject => "gitlab | #{@note.project.name} ", :from => EMAIL_OPTS["from"])
24 end 24 end
25 25
26 def note_commit_email(user, note) 26 def note_commit_email(user, note)
@@ -28,7 +28,7 @@ class Notify < ActionMailer::Base @@ -28,7 +28,7 @@ class Notify < ActionMailer::Base
28 @note = note 28 @note = note
29 @project = note.project 29 @project = note.project
30 @commit = @project.repo.commits(note.noteable_id).first 30 @commit = @project.repo.commits(note.noteable_id).first
31 - mail(:to => @user.email, :subject => "gitlab | #{@note.project.name} ") 31 + mail(:to => @user.email, :subject => "gitlab | #{@note.project.name} ", :from => EMAIL_OPTS["from"])
32 end 32 end
33 33
34 def note_issue_email(user, note) 34 def note_issue_email(user, note)
@@ -36,6 +36,6 @@ class Notify < ActionMailer::Base @@ -36,6 +36,6 @@ class Notify < ActionMailer::Base
36 @note = note 36 @note = note
37 @project = note.project 37 @project = note.project
38 @issue = note.noteable 38 @issue = note.noteable
39 - mail(:to => @user.email, :subject => "gitlab | #{@note.project.name} ") 39 + mail(:to => @user.email, :subject => "gitlab | #{@note.project.name} ", :from => EMAIL_OPTS["from"])
40 end 40 end
41 end 41 end
config/email.yml 0 → 100644
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +from: notify@gitlabhq.com
config/initializers/load_config.rb
1 GITOSIS = YAML.load_file("#{Rails.root}/config/gitosis.yml") 1 GITOSIS = YAML.load_file("#{Rails.root}/config/gitosis.yml")
  2 +EMAIL_OPTS = YAML.load_file("#{Rails.root}/config/email.yml")