• General
  • [SOLVED] [Howto] send mail with a relay host on a fresh install

use the correct relay host settings on a fresh install
pretty frustrating not getting info out of the RTFM ... so here we go

step-1:
set up /etc/postfix/sasl_passwd
looks something like that:
[smtp.provider.tld] username:password
run postmap /etc/postfix/sasl_passwd

step-2
add to /etc/postfix/main.cf
relayhost = [smtp.provider.com] if not already there use [ ] otherwise MX records

add / check sasl stuff block

#---/start
#enable SASL authentication
smtp_sasl_auth_enable = yes
#disallow methods that allow anonymous authentication.
smtp_sasl_security_options = noanonymous
#where to find sasl_passwd
smtp_sasl_password_maps = lmdb:/etc/postfix/sasl_passwd
#Enable STARTTLS encryption
smtp_use_tls = yes
#where to find CA certificates
#smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
#---/end

step-3
check log of postfix if some of the settings above are
overwritten like smtp_use_tls = yes

run postmap /etc/postfix/sasl_passwd
restart / reload postfix

---- clean logfile on postfix: /start

connect from localhost[::1]
[2021-09-23 09:51:36.793308]: C19A7CFD9: client=localhost[::1]
[2021-09-23 09:51:36.795816]: C19A7CFD9: message-id=<faca86a53e84704380ba08f3e285e111@localhost>
[2021-09-23 09:51:36.810239]: C19A7CFD9: from=user@domain.com, size=1432, nrcpt=1 (queue active)
[2021-09-23 09:51:36.811713]: disconnect from localhost[::1] helo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
[2021-09-23 09:51:42.079096]: C19A7CFD9: to=user@foreign.tld, relay=relayhost.doamin.tld[11.222.333.44]:25, delay=0.0, delays=0.03/0.02/0.23/5, dsn=2.0.0, status=sent (250 OK id=1kTJXG-000CLS-V4)
[2021-09-23 09:51:42.080031]: C19A7CFD9: removed

---- clean logfile on postfix: /end

a month later
noplan changed the title to [SOLVED] [Howto] send mail with a relay host on a fresh install .
2 years later

© 2020-2024 grommunio GmbH. All rights reserved. | https://grommunio.com | Data Protection | Legal notice