Last active
July 10, 2019 18:39
-
-
Save viniroger/962b7e46b397a740eeaf1798866d3a9a to your computer and use it in GitHub Desktop.
Shell script to send e-mail with attachments and body to mails list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
envio_email(){ | |
# Escrever corpo do e-mail | |
echo "Seguem anexos" >> $arq_email | |
printf "\n" >> $arq_email | |
# Arquivo de texto no corpo de e-mail | |
cat $arq_descr >> $arq_email | |
# Criar lista de e-mails a partir de arquivo | |
readarray -t lista_emails < <(cat $DIR/helpers/destinatarios_teste.txt | grep $grupo | awk -F',' '{print $1}') | |
# Enviar e-mails para clientes | |
for mail in ${lista_emails[@]}; do | |
echo enviando e-mail com anexo para $mail | |
cat $DIR/saida/corpo_email.txt | mutt -e 'my_hdr Reply-To:teste@teste.com.br,teste2@teste.com.br' -s "Assunto ${data}" -a "$DIR/saida/arquivo.zip" -- $mail | |
done | |
} | |
envio_email |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment