Skip to main content
Configure mail sending via sSMTP on Linux
Last update:

Configure mail sending via sSMTP on Linux

For your information

This is an instruction to configure mailing via Selectel mail service using the sSMTP utility on a Linux server.

  1. Connect to the server in the Selectel instrastructure from which you plan to send mailings:

    Connect to the server via SSH or via KVM-console.

  2. Install sSMTP:

    sudo yum update
    sudo yum install ssmtp
  3. Install the mailx helper utility to send mail:

    sudo apt install mailx
  4. Set nano:

    sudo yum install nano
  5. Open the ssmtp.conf configuration file:

    nano /etc/ssmtp/ssmtp.conf
  6. Change the contents of the file:<port>
    # If <port>=1126, UseTLS=No


    • <port> — port:

      • 1126 — if you want to establish a no SSL / STARTTLS connection;
      • 1127 — if you want to establish a TLS (SSL) connection.
    • <login> — login received in service connection ticket;

    • <password> — the password received in the service connection ticket;

    • <> — the domain from which to send mailings.

  7. Close the file (Ctrl+X) and save your changes (Y).

  8. Open the revaliases configuration file:

    sudo nano /etc/ssmtp/revaliases
  9. Add a line with the address to be displayed as the sender's address in mailings through the mail service:



    • <sender_email> — the address of the sender on the domain you connected to the mail service, for example,;
    • <port> — the port you specified in step 6.
  10. Close the file (Ctrl+X) and save the changes made (Y).

  11. Replace the default mail sender with the customized sSMTP:

    sudo mv /usr/sbin/sendmail /usr/sbin/sendmail.orig
  12. Create a symlink to ssmtp instead of sendmail:

    sudo ln -s /usr/sbin/ssmtp /usr/sbin/sendmail
  13. Send a test mailing:

    $ echo test | mail -s "testing ssmtp" <recipient_email>

    Specify <recipient_email> — the address to which you want to send the test mailing.