lib/mutx/support/mail_sender.rb in mutx-0.1.42 vs lib/mutx/support/mail_sender.rb in mutx-0.1.43
- old
+ new
@@ -7,19 +7,19 @@
module Support
class MailSender
def sender(result_id, subject, email, name, id, type, cucumber, notify_on, attach_folder)
if Mutx::Support::Configuration.email_configured?
- if Mutx::Support::Configuration.specific_vm.eql? true #if true => "10.0.60.36" belgrano's vm
+ if Mutx::Support::Configuration.smtp_enable_start_tls_auto.eql? false
Mail.defaults do
delivery_method :smtp, {
address: Mutx::Support::Configuration.smtp_address,
port: Mutx::Support::Configuration.smtp_port,
enable_starttls_auto: Mutx::Support::Configuration.smtp_enable_start_tls_auto
}
end
- else
+ else #if smtp_enable_start_tls_auto == true
Mail.defaults do
delivery_method :smtp, {
address: Mutx::Support::Configuration.smtp_address,
port: Mutx::Support::Configuration.smtp_port,
domain: Mutx::Support::Configuration.smtp_domain,
@@ -64,11 +64,12 @@
#mail.html_part = html_part #Adjunta al mail
File.open("result.html", "w") { |file| file.write("#{html_part.body}") }
mail.add_file "result.html"
files = Dir.glob("#{attach_folder}/*").select{ |e| File.file? e }
- (files.each do |file|
+ ( Mutx::Database::MongoConnector.file_attached (result_id)
+ files.each do |file|
mail.add_file file
end) if !files.empty?
#fin seteo template
else
@@ -85,10 +86,12 @@
html_part.content_type = "text/html; charset=UTF-8"
template1 = File.read(template_body_path)
html_part.body = ERB.new(template1).result(data.instance_eval { binding })
mail.html_part = html_part
+ puts
puts "SENDING RESULT VIA EMAIL"
+ puts
tries = 3
begin
mail.deliver!#send mail
rescue StandardError