Postfix

From Leo's Notes
Revision as of 20:55, 9 December 2021 by Leo (talk | contribs)
This page was last edited on 9 December 2021, at 20:55.

Mail Relay

To use Postfix as a mail relay server, edit the /etc/postfix/main.cf configuration file and set the relayhost value.

relayhost = [smtp.example.com]:587

Note that the server name is in square brackets, followed by the port number. For servers that require TLS, set the following as well:

smtp_use_tls = yes
smtp_sasl_auth_enable = no

This assumes that smtp.example.com accepts TLS encrypted SMTP connections via 587.

Restart postfix to apply these changes.

Sending email messages

To send a HTML message:

$ (
    echo "To: user@example.com"
    echo "Subject: HTML test"
    echo "Content-Type: text/html"
    echo
    cat email-message.html
) | sendmail.postfix -t

See Also