Alpine 寄出信件設定

  • 安裝套件

    apk add msmtp mailx

  • 設定 smtp server → /etc/msmtprc
    # Set default values for all following accounts.
    defaults
    auth           on
    tls            on
    tls_trust_file /etc/ssl/certs/ca-certificates.crt
    syslog         on
    
    # Gmail
    account        gmail
    host           smtp.gmail.com
    port           587
    from           <your email>
    user           <your gmail account>
    password       <your password>
    
    # Set a default account
    account default : gmail
    aliases        /etc/aliases
  • 設定 sendmail alias → /etc/local.d/msmtp-sendmail.start
    #!/bin/sh
    ln -sf /usr/bin/msmtp /usr/bin/sendmail
    ln -sf /usr/bin/msmtp /usr/sbin/sendmail
  • 設定 msmtp-sendmail.start 權限與第一次執行

    chmod +x /etc/local.d/msmtp-sendmail.start
    /etc/local.d/msmtp-sendmail.start

  • 測試寄出信件

    cat /etc/issue | mail -s "Test Mail from Alpine" [email protected]

  • tech/alpine_mail.txt
  • 上一次變更: 2024/04/08 00:24
  • jonathan