Skip to content

Commit

Permalink
Merge pull request #61 from Dirack/feature/issue/60
Browse files Browse the repository at this point in the history
Programa morse lê email a ser enviado a partir de um arquivo Resolve #60
  • Loading branch information
Dirack authored Apr 23, 2020
2 parents 1c84801 + 523b243 commit 9d98be8
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions morse
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,21 @@ case "$1" in

-e) ## Enviar email

read -p "Email destino: " PARA
[ $? -ne 0 ] && exit
# Se o usuário não passar nenhum arquivo com as informações
# do email, peça para ele digitar
if [ -z "$2" ]
then
read -p "Email destino: " PARA
[ $? -ne 0 ] && exit

read -p "Email origem: " DE
[ $? -ne 0 ] && exit
read -p "Email origem: " DE
[ $? -ne 0 ] && exit

echo -n "Senha: "; read -s XPS; echo " "
[ $? -ne 0 ] && exit
echo -n "Senha: "; read -s XPS; echo " "
[ $? -ne 0 ] && exit

read -p "Assunto: " ASSUNTO
[ $? -ne 0 ] && exit
read -p "Assunto: " ASSUNTO
[ $? -ne 0 ] && exit

cat << EOF > "$TMP"
Expand All @@ -84,9 +88,18 @@ cat << EOF > "$TMP"
EOF

vi "$TMP"
vi "$TMP"
MENSAGEM=$(cat $TMP | sed -n '/^#/! p' | sed 's/$/<br>/' )
else
FILE="$2"
PARA=$(sed -n '1p' "$FILE")
DE=$(sed -n '2p' "$FILE")
XPS=$(sed -n '3p' "$FILE")
ASSUNTO=$(sed -n '4p' "$FILE")
sed -n '1,4!p' "$FILE" >> "$TMP"
MENSAGEM=$(cat $TMP | sed -n '/^#/! p')
fi

MENSAGEM=$(cat $TMP | sed -n '/^#/! p' | sed 's/$/<br>/' )
echo "Enviando email ..."

## envie o arquivo por email
Expand Down

0 comments on commit 9d98be8

Please sign in to comment.