• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question Use SMTP while MX record is to a different server

Wim Haanstra

New Pleskian
I have a Plesk 12.5 installation, running on a CentOS machine, which uses Postfix for SMTP.

I have a domain, which is hosted on this machine, but the MX records for this domain point to a different server. The application that is running on this machine (Ruby on Rails site), needs an SMTP server to send certain emails.

The RoR application has this server configured as SMTP server, with a username and password for a user I created using Plesk.

If I have the Mail service for this site enabled, none of the emails are getting delivered to the right server. Emails are rejected with the message "Recipient address rejected: User unknown in virtual mailbox table;". (This is logical, because the account the email is send to, doesn't exist on the server).

If I disable the mail service for this domain, I can no longer send email using my application, because password authentication fails (which is also logical).

Is there a way to have both? Be able to send emails from the server using an email address from the domain that is hosted on the machine, but they are send to the right server?
 
Why not just use the remote SMTP server's credentials. You for sure want mail service "Off" locally. It's going to cause problems if you keep it on (e.g., your website scripts trying to mail locally and other clients on that same machine not being able to email that client).
 
Why not just use the remote SMTP server's credentials. You for sure want mail service "Off" locally. It's going to cause problems if you keep it on (e.g., your website scripts trying to mail locally and other clients on that same machine not being able to email that client).

I really don't want to store any credentials of the 'external' mail server on this server. Mostly because it's an Office 365 server.
 
I think you will have to. I don't see that as a security risk if your files are properly protected from viewing these credentials, and you are using encrypted authentication. Alternatively, you should be able to configure Ruby to just use the server's sendmail and not worry about a remote SMTP.

config.action_mailer.delivery_method = :smtp

becomes

config.action_mailer.delivery_method = :sendmail
 
Back
Top