Per evitar que Gmail i Outlook marquin els correus-e procedents del nostre com a servidor com a correu brossa ens pot interessar fer relay en un altre SMTP, i més concretament fer relay d’alguns usuaris concrets.
Afegim el fitxer /etc/postfix/bysender
:
user@example.com [smtp.otherserver.com]:port
- Nota: Si no posem la part de user farà relay de tot el domini.
Indiquem les credencials al fitxer /etc/postfix/sasl/sasl_passwd
:
[smtp.otherserver.com]:port email@otherserver.com:password
Fem el hash/map del fitxer:
# postmap /etc/postfix/bysender
# postmap /etc/postfix/sasl/sasl_passwd
Protegim els fitxers:
# chown root:root /etc/postfix/sasl/sasl_passwd /etc/postfix/sasl/sasl_passwd.db # chmod 0600 /etc/postfix/sasl/sasl_passwd /etc/postfix/sasl/sasl_passwd.db
Editem el fitxer /etc/postfix/main.cf
:
# Load relays file sender_dependent_relayhost_maps = hash:/etc/postfix/bysender # Enable SASL authentication smtp_sasl_auth_enable = yes # Disallow methods that allow anonymous authentication smtp_sasl_security_options = noanonymous # Location of sasl_passwd smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd # Location of CA certificates smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
Reiniciem el servei:
# service postfix restart
Fonts:
- https://www.linode.com/docs/email/postfix/configure-postfix-to-send-mail-using-gmail-and-google-apps-on-debian-or-ubuntu/
- https://mad9scientist.com/postfix-relay-mail-specific-domains/