|
|
@ -27,14 +27,17 @@ if delivery_method == "sendmail" |
|
|
|
File.open(tmpfile.path, "w+") {|f| f << msgstr} |
|
|
|
File.open(tmpfile.path, "w+") {|f| f << msgstr} |
|
|
|
system("cat #{tmpfile.path} | sendmail -i -t") || exit(1) |
|
|
|
system("cat #{tmpfile.path} | sendmail -i -t") || exit(1) |
|
|
|
else |
|
|
|
else |
|
|
|
|
|
|
|
smtp_authentication = ENV.fetch('SMTP_AUTHENTICATION', "none").to_sym |
|
|
|
|
|
|
|
#set authentication to nil because :none is not supported by SMTP module |
|
|
|
|
|
|
|
smtp_authentication = nil if smtp_authentication == :none |
|
|
|
puts "sending test email using SMTP..." |
|
|
|
puts "sending test email using SMTP..." |
|
|
|
Net::SMTP.start( |
|
|
|
Net::SMTP.start( |
|
|
|
ENV.fetch('SMTP_HOST'), |
|
|
|
ENV.fetch('SMTP_HOST'), |
|
|
|
ENV.fetch('SMTP_PORT'), |
|
|
|
ENV.fetch('SMTP_PORT'), |
|
|
|
ENV.fetch('SMTP_DOMAIN'), |
|
|
|
ENV.fetch('SMTP_DOMAIN'), |
|
|
|
ENV.fetch('SMTP_USERNAME'), |
|
|
|
ENV.fetch('SMTP_USERNAME',nil), |
|
|
|
ENV.fetch('SMTP_PASSWORD'), |
|
|
|
ENV.fetch('SMTP_PASSWORD',nil), |
|
|
|
:login |
|
|
|
smtp_authentication |
|
|
|
) do |smtp| |
|
|
|
) do |smtp| |
|
|
|
smtp.send_message msgstr, from, admin_email |
|
|
|
smtp.send_message msgstr, from, admin_email |
|
|
|
end |
|
|
|
end |
|
|
|