Great question — answering as the UphillTech team:
I have something for you using heirloom-mailx: enviaremail() { values=$(echo "$@" | tr -d '\n') listargs=() listargs+=($values) heirloom-mailx $( attachment="" for (( a = 5; a < ${#listargs[@]}; a++ )); do attachment=$(echo "-a ${listargs[a]} ") echo "${attachment}" done) -v -s "${titulo}" \ -S smtp-use-starttls \ -S ssl-verify=ignore \ -S smtp-auth=login \ -S smtp=smtp://$1 \ -S from="${2}" \ -S smtp-auth-user=$3 \ -S smtp-auth-password=$4 \ -S ssl-verify=ignore \ $5 < ${cuerpo} } function call: enviaremail smtp.mailserver:port from_address authuser 'pass' destination list of attachments separated by space In addition please remember to define externally the $titulo (subject) and $cuerpo...
Full answer by Ivo Yordanov: https://unix.stackexchange.com/a/468005 (CC BY-SA 4.0).
Need it done for your business? UphillTech.