Tuesday, January 2, 2024

Kirim EMail dari Linux CentOS 7 (postfix)

  1.  Update OS
    sudo yum update -y

  2. Install Postfix dan Mailx
    sudo yum install -y postfix cyrus-sasl-plain mailx

  3. Configure Postfix
    sudo vi /etc/postfix/main.cf

    Tambahkan config berikut :
    relayhost = [smtp.gmail.com]:587
    smtp_use_tls = yes
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    smtp_sasl_security_options = noanonymous
    smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt



    Create file 'sasl_passwd' : 
    sudo nano /etc/postfix/sasl_passwd

    isi file tersebut dengan teks berikut :
    [smtp.gmail.com]:587 youremail@gmail.com:yourpassword


  4. Amankan Credentials dan Update Postfix
    Atur owner dan file permission :
    sudo chown root:root /etc/postfix/sasl_passwd
    sudo chmod 600 /etc/postfix/sasl_passwd
    sudo postmap /etc/postfix/sasl_passwd


    Restart dan enable Postfix :
    sudo systemctl restart postfix
    sudo systemctl enable postfix


  5. Ujicoba kirim email via smtp google
    echo "This is a test email" | mailx -s "Test Email Subject" recipient@example.com

Sumber : this website

No comments:

Post a Comment

Cara Update SSL Pada Docker Owncloud

 Misal ID Docker Owncloud adalah 7213d7a41122 , dengan name : owc10-2  File certificate SSL dan file config https ( https.conf ) ditempatkan...

Popular Posts