Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Remove postinstall and bash-based mail check

Oliver Günthercb6d9c715c30
diff --git a/packaging/scripts/check b/packaging/scripts/check
index 7d3fa8fd403..bd98c43d9bd 100755
--- a/packaging/scripts/check
+++ b/packaging/scripts/check
@@ -34,13 +34,3 @@ if ps -u "$APP_USER" -f | grep -q "rake jobs:work" ; then
else
log_ko "openproject background job worker is NOT running"
fi
-
-if [ -z "$ADMIN_EMAIL" ]; then
- log_ko "no ADMIN_EMAIL set. Can't test email settings."
-else
- if $(pwd)/packaging/scripts/send-test-email ; then
- log_ok "test email sent to ${ADMIN_EMAIL}"
- else
- log_ko "unable to send test email to ${ADMIN_EMAIL}"
- fi
-fi
diff --git a/packaging/scripts/send-test-email b/packaging/scripts/send-test-email
deleted file mode 100755
index 9a9d9471aae..00000000000
--- a/packaging/scripts/send-test-email
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'net/smtp'
-require 'time'
-require 'securerandom'
-require 'tempfile'
-
-admin_email = ENV.fetch('ADMIN_EMAIL') { fail "no ADMIN_EMAIL set" }
-smtp_domain = ENV.fetch('SMTP_DOMAIN') { "example.net" }
-from = "no-reply@#{smtp_domain}"
-delivery_method = ENV.fetch('EMAIL_DELIVERY_METHOD') { "sendmail" }
-
-msgstr = <<~END_OF_MESSAGE
- From: OpenProject <#{from}>
- To: #{admin_email}
- Subject: Test message
- Date: #{Time.now.httpdate}
- Message-Id: <#{SecureRandom.hex}@#{smtp_domain}>
- #{' '}
- This is a test message to verify your OpenProject settings.
- If you see this, this means OpenProject email settings are working properly.
-END_OF_MESSAGE
-
-if delivery_method == "sendmail"
- puts "sending test email using sendmail..."
- tmpfile = Tempfile.new("mail-test")
- File.open(tmpfile.path, "w+") { |f| f << msgstr }
- system("cat #{tmpfile.path} | sendmail -i -t") || exit(1)
-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..."
- smtp = Net::SMTP.new(
- ENV.fetch('SMTP_HOST'),
- ENV.fetch('SMTP_PORT')
- )
- smtp.enable_starttls_auto if ENV.fetch('SMTP_ENABLE_STARTTLS_AUTO', 'false') == 'true'
- smtp.start(
- ENV.fetch('SMTP_DOMAIN'),
- ENV.fetch('SMTP_USERNAME', nil),
- ENV.fetch('SMTP_PASSWORD', nil),
- smtp_authentication
- )
- smtp.send_message msgstr, from, admin_email
- smtp.finish
-end