ActionMailer not delivering mail from one particular server

We have a client who insisted on having their Rails app set up with
Oracle
DB on a Red Hat Enterprise Linux server behind their VPN. This is not a
setup we are very familiar with as we generally run DigitalOcean
droplets
with Ubuntu and use MySQL/PostgreSQL. Needless to say, this has caused a
lot of problems, including the latest mystery that we’ve yet to solve.
We
have this app running on an Ubuntu staging server where everything works
fine, but the copy running on the RHEL server will not deliver emails
through ActionMailer.

We use Postmark as our delivery service, and so far we have ruled out:
Postmark, the VPN, firewalls, the Postmark gem, and the Mail gem. I’ve
written several test scripts to test each layer, and the failure is at
the
ActionMailer level. Here are the tests:

require ‘postmark’

client = Postmark::ApiClient.new(ENV[‘API_TOKEN’])

client.deliver(
from: ‘Foo B. [email protected]’,
to: ‘Foo B. [email protected]’,
subject: ‘Testing Postmark’,
text_body: ‘We want to know if Postmark works on the server’
)

=> Success. We received the email

api_token =
FooBar::Application.config.action_mailer.postmark_settings[:api_key]

message = Mail.new do
from “Foo B. [email protected]
to “Foo B. [email protected]
subject “Testing Mail+Postmark”
body “Testing the Mail gem.”
end

message.delivery_method Mail::Postmark, {:api_key => api_token}
message.deliver

=> Success. We received the email

class TestActionMailer < ActionMailer::Base
default from: ‘[email protected]

def test_mail
mail(
to: ‘[email protected]’,
subject: ‘Test ActionMailer’,
body: ‘Testing ActionMailer’
)
end
end

TestActionMailer.test_mail.deliver

=> On Ubuntu: Success. On RHEL: Silent Failure

There are no errors or anything. The app behaves exactly as though the
email has been delivered, however, there are no emails received. We’ve
wasted several days trying different things and we still can’t figure it
out.

Another possibly relevant detail is that when we initially set the
server
up, SELinux was giving Apache+Passenger trouble, so we set SELinux to
permissive mode and then it worked. I don’t know what else to try. Why
would the Mail gem work but ActionMailer silently fail on only one
particular machine?