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

后端 未结 26 2584
盖世英雄少女心
盖世英雄少女心 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:21

    If mutt is not working or not installed,try this-

    *#!/bin/sh
    
    FilePath=$1
    FileName=$2
    Message=$3
    MailList=$4
    
    cd $FilePath
    
    Rec_count=$(wc -l < $FileName)
    if [ $Rec_count -gt 0 ]
    then
    (echo "The attachment contains $Message" ; uuencode $FileName $FileName.csv ) | mailx -s "$Message" $MailList
    fi*
    

提交回复
热议问题