07RelaySmtp - amagerard/Mail GitHub Wiki

HOME

Redhat/Mail

1- Network 2- Postfix 3- Dovecot 4- Postfixadmin 5- PostfixMariaDB 6- DovecotMariaDB
7- RelaySmtp 8- Troubleshoot 9- Selinux 10- GnomeShell 11- Backup

7. Relay-smtp.

The mail server is not known to the internet.
It is to send emails to the outside.

7.1 Prerequisites.

  • Provider which does not impose double identification.
  • Port smtp : 587 TLS.
  • Have an email account (login, password).
  • Self-signed certificates.

7.2 Configuration.

vi /etc/postfix/main.cf
Be careful if a line already exists.

# auto certificates signed not issued by a certification authority  
smtpd_tls_cert_file = /etc/ssl/certs/hermes.crt  
smtpd_tls_key_file = /etc/ssl/private/hermes.key  
smtp_tls_CApath = /etc/ssl/certs  
smtp tls_CAfile = /etc/ssl/certs/CA.crt  

vi /etc/postfix/main.cf
To be added at the end of your file.

relayhost = [smtp.provider.com]:587  
smtp_use_tls = yes  
smtp_tls_security_level = may  
smtp_sasl_auth_enable = yes  
smtp_sasl_security_options = noanonymous  
header_size_limit = 409600  
smtp_generic_maps = hash:/etc/postfix/generic_host  
smtp_sasl_password_maps = hash:/etc/postfix/smarthost_passwd  

vi /etc/postfix/smarthost_passwd

 [smtp.provider.com]:587   < your account from provider>:<password>  
 # example : [smtp.googl.com]:587   [email protected]:67jkipkBHJnFTT  

vi /etc/postfix/generic_host

@<your domain>   <your email from provider>  
# example: @ol26modk.com    [email protected]  

Create generic_host.db file.
postmap /etc/postfix/generic_host
Create smarthost_passwd.db file.
postmap /etc/postfix/smarthost_passwd

chmod 650 /etc/postfix/smarthost_passwd.db
chmod 650 /etc/postfix/generic_host.db

systemctl restart postfix

rm /etc/postfix/smarthost_passwd
rm /etc/postfix/generic_host

7.3 Test.

From an email account that you have created.
Send an e-mail to an e-mail address from another domain
known to the Internet.

Please reinstall cyrus-sasl-plain if you uninstall gnome.

⚠️ **GitHub.com Fallback** ⚠️