Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Mailsetting now writes a file to confirm the status

  • Loading branch information...
commit 937061780a37208abfa91baae3482e31edf048d4 1 parent fbf6080
@vmoravec authored
Showing with 9 additions and 7 deletions.
  1. +9 −7 plugins/mailsetting/app/models/mailsetting.rb
View
16 plugins/mailsetting/app/models/mailsetting.rb
@@ -43,7 +43,7 @@ class Mailsetting < BaseModel::Base
validates :password_confirmation, :presence=>true
validates :transport_layer_security, :presence=>true
- TEST_MAIL_FILE = File.join(YaST::Paths::VAR,"mail","test_sent")
+ TEST_MAIL_FILE = File.join(YaST::Paths::VAR,"mailsetting","test_sent")
CACHE_ID = "webyast_mailsetting"
# read the settings from system
@@ -87,15 +87,17 @@ def self.send_test_mail(to)
to.tr!("~'\"<>","")
`/bin/echo "#{message}" | /bin/mail -s "WebYaST Test Mail" '#{to}' -r root`
- unless File.directory? File.join(YaST::Paths::VAR,"mail")
- Rails.logger.debug "directory does not exists...."
+ mail_directory = File.join(YaST::Paths::VAR,"mailsetting")
+ unless File.directory? mail_directory
+ Rails.logger.debug "Directory #{mail_directory} does not exists"
return
end
begin
- f = File.new(TEST_MAIL_FILE, 'w')
- f.puts "#{to}"
- rescue
- Rails.logger.error "writing #{TEST_MAIL_FILE} file failed - wrong permissions?"
+ File.open TEST_MAIL_FILE, 'w' do |file|
+ file.puts to.to_s
+ end
+ rescue => error
+ Rails.logger.error e
end
end
end

0 comments on commit 9370617

Please sign in to comment.
Something went wrong with that request. Please try again.