This will describe how to make your openSUSE machine send e-mail via reliable relayhost of your choice using Postfix. I will use gmail as an example.

  1. Installing required packages

    zypper in postfix cyrus-sasl libsasl2-3 cyrus-sasl-plain cyrus-sasl-gssapi
  2. Configure Postfix:

    cp /etc/postfix/{,_bak}
    cat <<EOT >> /etc/postfix/
    compatibility_level = 3.6
    queue_directory = /var/spool/postfix
    command_directory = /usr/sbin
    daemon_directory = /usr/lib/postfix/bin/
    data_directory = /var/lib/postfix
    mail_owner = postfix
    inet_interfaces =,::1
    setgid_group = maildrop
    relayhost = []:587
    smtp_use_tls = yes
    smtp_sasl_auth_enable = yes
    smtp_sasl_security_options =
    smtp_sasl_password_maps = lmdb:/etc/postfix/sasl_passwd
    smtp_tls_CAfile = /etc/ssl/ca-bundle.pem
  3. Create sasl_passwd file and

    echo "[]:587 $$PASSWORD" >> /etc/postfix/sasl_passwd
    postmap /etc/postfix/sasl_passwd
  4. Restart the systemd service

    systemctl enable --now postfix.service
  5. Test it out

    echo "This is just a test." | mail -r "" -s "A test of the system mail system" -Ssendwait

    The -Ssendwait makes the mail program wait until the e-mail is really submited to the queue instead of doing it in background.