How do I send a file as an email attachment using Linux command line?

后端 未结 26 3215
盖世英雄少女心
盖世英雄少女心 2020-11-22 04:39

I\'ve created a script that runs every night on my Linux server that uses mysqldump to back up each of my MySQL databases to .sql files and packages them togeth

26条回答
  •  说谎
    说谎 (楼主)
    2020-11-22 05:15

    Another alternative - Swaks (Swiss Army Knife for SMTP).

    swaks -tls \
        --to ${MAIL_TO} \
        --from ${MAIL_FROM} \
        --server ${MAIL_SERVER} \
        --auth LOGIN \
        --auth-user ${MAIL_USER} \
        --auth-password ${MAIL_PASSWORD} \
        --header "Subject: $MAIL_SUBJECT" \
        --header "Content-Type: text/html; charset=UTF-8" \
        --body "$MESSAGE" \
        --attach mysqldbbackup.sql
    

提交回复
热议问题