Skip to content
KVKK & GDPR Compliant Turkey Data Center 24/7 Technical Support destek@mxgate.com.tr
New: IP reputation monitoring is now free on every plan Start your 14-day free trial →
INTEGRATION GUIDE · PLESK

Plesk Smarthost Setup

On Plesk the whole setup happens on one screen: on the Smarthost page under Tools & Settings you tick a box and enter the address and credentials. When you save, Plesk generates the Postfix configuration itself — no file editing needed. Your inbound settings and MX records are left untouched.

Time
About 5 minutes
Requires
Plesk administrator access
Version
Obsidian 18.x · Onyx 17.x · Postfix
Address
[smtp.mxgate.com.tr]:587
Scope
Outbound mail only
WHAT CHANGES

The only thing that changes is the path out

Today Postfix on your Plesk server delivers email straight to the recipient’s server, and whether it arrives is decided by the reputation of your server’s IP address alone. After setup, the same message is handed to MXGate first, inspected there, and sent on from continuously monitored addresses.

Now Plesk / Postfix Recipient server Mail leaves directly. Whether it is delivered depends only on the reputation of your server’s IP address.
After setup Plesk / Postfix MXGate :587 Recipient server Mail is first handed to MXGate over an authenticated, encrypted connection, inspected there, and sent on from continuously monitored addresses.
Mailboxes, accounts and subscription settings stay where they are Plesk generates the Postfix configuration; you edit no files Inbound mail is redirected separately via the MX record; this guide does not cover it For an overview of the method, see the Smarthost page, and for inspection on outbound traffic Outbound Filtering
SETUP

Plesk smarthost setup in six steps

The steps are applied in order in the Plesk interface. You only need the command line, and no file editing at all, for the log check in the last step.

  1. Open the Smarthost screen in Plesk

    Log in to the Plesk administrator panel and open the Smarthost link under the Mail heading in Tools & Settings. On older Plesk versions the same setting lives in the SMTP relay section of the Mail Server Settings page.

    PLESK PATH copy
    Tools & Settings › Mail › Smarthost
  2. Enable the smarthost and enter the address

    Tick the “Send users’ mail via a smarthost” box and enter the MXGate server in the address field. Plesk has no separate port field; the port is given inside the address in bracket notation.

    Tools & Settings › Mail › Smarthost
    Send users’ mail via a smarthost
    Smarthost address
    [smtp.mxgate.com.tr]:587
    Authentication required
    Username
    username from the panel
    Password
    ••••••••••••
    Check Connection OK

    A representation of the screen. The field names match the English labels in the Plesk interface.

    Write the address as [smtp.mxgate.com.tr]:587. The brackets tell Postfix to resolve the address directly instead of looking up an MX record; without them delivery can fail.
  3. Turn on authentication

    Tick the “Authentication required” box and enter the username and password from your MXGate panel. These credentials belong to your server and are used only for the outbound connection.

    The connection is not accepted without authentication. Do not wrap the password in quotes, and make sure no leading or trailing space is copied with it.
  4. Test the connection with Check Connection

    Before saving, press the Check Connection button. Plesk tries to connect to the address you entered and authenticate, then shows the result on screen. If it fails you can fix it before saving.

    This step also verifies that the server can reach MXGate on port 587. If the connection cannot be established, the problem is usually the firewall rather than the settings.
  5. Save with OK

    Press OK. Plesk updates the Postfix configuration itself and restarts the service; you do not need to edit any files by hand. It can take up to half a minute, so wait without closing the page.

    Manual configuration is overwritten: if you previously added a relayhost line to main.cf by hand, it is replaced by Plesk’s generated setting the moment you save on this screen.
  6. Send a message and read the log

    Send a message from an account on the server to an external address and confirm in the mail log that it left through MXGate. If you see the relay address in the log, the setup is working.

    TEST · LOG copy
    # Watch the live mail log
    tail -f /var/log/maillog
    # On Debian / Ubuntu
    tail -f /var/log/mail.log
    
    # The line you should see in the log
    status=sent (250 2.0.0 Ok: queued) relay=smtp.mxgate.com.tr[…]:587
    Setup complete. Once you see this line, all mail leaving the server is going through MXGate, authenticated and encrypted.
SCOPE

The whole server, or a single domain?

Plesk lets you define a smarthost in two places. When both are set, the domain-level definition wins.

Server-wide Tools & Settings › Mail › Smarthost Mail from every domain on the server uses this setting. It is the setup described in this guide, and in most cases the right one.
Per domain Websites & Domains › domain › Mail › Smarthost It applies only to that domain’s mail and takes priority over the server-wide setting. Use it when you want to move one customer to a separate route. You can see every configured smarthost on the Mail > Smarthosts screen.
ALTERNATIVE

No access to the interface? Configure on the Postfix side

If the Plesk interface is available, prefer the route above. The configuration below is only needed when you cannot reach the interface, and the two approaches should not be mixed.

Do not mix the two. A relayhost line you write by hand is replaced by Plesk’s generated setting the first time you enable the smarthost from the interface.
/etc/postfix/main.cf append
# Back it up first
cp /etc/postfix/main.cf /etc/postfix/main.cf.bak

# Add the lines below
relayhost = [smtp.mxgate.com.tr]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
/etc/postfix/sasl_passwd credentials
# One line: the address, then user:password
[smtp.mxgate.com.tr]:587 KULLANICI:SIFRE

# Restrict permissions, build the database, reload the service
chmod 600 /etc/postfix/sasl_passwd
postmap /etc/postfix/sasl_passwd
systemctl reload postfix

Field names and the screen path in the Plesk interface come from the vendor documentation: Plesk Obsidian — Configuring a Smarthost or Relayhost.

TROUBLESHOOTING

What does the error in your mail log mean?

The five rows below cover almost every error seen after a Plesk smarthost setup. Look for the text from your log in the left column.

Error in the log What it means Fix
SASL authentication failed The username or password was not accepted Confirm the Authentication required box is ticked on the Smarthost screen and copy the credentials from the panel again. No leading or trailing space should remain in the password.
Host or domain name not found The address is being resolved by looking up an MX record Write the address in brackets: [smtp.mxgate.com.tr]:587. Without them Postfix looks for an MX record for the name and does not find one.
Connection timed out Outbound access to port 587 is blocked Allow outbound port 587 in the server firewall and on your provider’s network. The Check Connection button reveals this before you save.
The setting saves but has no effect A different smarthost is defined at domain level List the configured smarthosts on the Mail > Smarthosts screen. A domain-level definition overrides the server-wide one.
My hand-written setting disappeared Saving from the interface overwrites manual configuration Do not mix the two approaches. If you have decided to use the interface, remove the hand-written relayhost line from main.cf.

Rolling back

If you want to undo the setup, go back to the same screen, untick “Send users’ mail via a smarthost” and save with OK. Plesk regenerates the Postfix configuration and the server goes back to sending mail directly as before.

FAQ

Questions from Plesk administrators

Where do I find the smarthost setting in Plesk?

In Plesk Obsidian it is on the Smarthost page under the Mail heading in Tools & Settings. On older versions the same setting is in the SMTP relay section of the Mail Server Settings page. You can see the list of configured smarthosts on the Mail > Smarthosts screen.

There is no separate port field — where do I enter 587?

You put the port inside the address: [smtp.mxgate.com.tr]:587. The square brackets tell Postfix to resolve the name directly rather than look up an MX record. Without them Postfix looks for an MX record for the address and delivery can fail.

Can I set it up for a single domain instead of the whole server?

Yes. A per-domain smarthost is defined at Websites & Domains > the domain > Mail > Smarthost. The domain-level definition takes priority over the server-wide one, so when you give a domain its own smarthost, that domain’s mail uses its own setting rather than the server-wide one.

What happens to settings I added to main.cf by hand?

When you enable the smarthost from the Plesk interface, your hand-written configuration is replaced by the one Plesk generates. So do not mix the two approaches: either manage it from the interface, or stay on the Postfix side and never open that screen.

Does this setup affect incoming email?

No. The setting only determines the path that mail leaving the server takes. Your MX records, mailboxes and inbound settings stay exactly as they are. Putting inbound traffic through MXGate as well is a separate step, made through the MX record.

Last updated: · Applies to: Plesk Obsidian 18.x · Onyx 17.x (Postfix)