In that case it would make sense to use Postfix I guess.
So I tried to set it up. But I couldn't get it to work properly.
I want it to send mails only via a remote SMTP server of my mail provider.
This provider only accepts mail where the 'from' address matches with my registered address.
So I somehow have to rewrite the from address.
#edit: I could get it to work like this:
Code:
# /etc/postfix/main.cf
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl/accounts
smtp_tls_security_level = encrypt
smtp_tls_wrappermode = yes
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
sender_canonical_maps = hash:/etc/postfix/sender_canonical
Code:
# /etc/postfix/sasl/accounts
[smtp.domain.tld]:465 address@domain.tld:password
Code:
# /etc/postfix/sender_canonical
root address@domain.tld
Code:
postmap /etc/postfix/sasl/accounts
postmap /etc/postfix/sender_canonical
chown root:root /etc/postfix/sasl/accounts /etc/postfix/sasl/accounts.db
chmod 0600 /etc/postfix/sasl/accounts /etc/postfix/sasl/accounts.db
systemctl reload postfix
echo "test" | mail -s "test subject" address@domain.tld
In the Postfix documentation it says that
wrappermode is a legacy thing for servers that don't support STARTTLS.
Is it less secure to turn this on? If I turn it off, I can't send the mail successfully.
But I'm confused about this anyway.
My mail provider does support STARTTLS but only on port 587.
And it also supports SSL/TLS on port 465.
Since SSL/TLS should be more secure than STARTTLS I want to use that one. But that's only possible with wrappermode turned on.