1

My daily backup script had to be changed to create base64 file instead of regular .tar.gz a while ago:

Filename64="$Filename".64
cat "$Filename" | base64 > "$Filename64"
echo -e "to: $EmailAddr\nsubject: $Filename64\n" | \
    (cat - && uuencode "$Filename64" "$Filename64") | ssmtp "$EmailAddr"

Recently I needed to recover a file from the daily backup. I was surprised to discover gmail automatically creates a second attachment 6MB larger in .com format (apparently). This second unwnanted attachment is called noname:

gmail backup 2 attachments.png

1). How can I prevent noname creation?

2). If creation unpreventable, How can I delete them en masse with gmail api?

2
  • 1
    Why are you uuencoding the file after it has been base64'd? That seems awfully redundant. Commented Jul 1, 2019 at 20:25
  • @grawity I really don't know. I just copied commands from someone else's script. Commented Jul 1, 2019 at 20:40

1 Answer 1

1

I was using instructions in the most up-voted answer:

that recommends:

echo -e "to: [email protected]\nsubject: subject\n"| (cat - && uuencode /path/to/attachment attachment.name) | ssmtp [email protected]

I did some new research and it seems uuencode was something popular 25 years ago but not so much today. The basic flaw with the bash script is uuencode is putting the attachment within the body of the message.

A much better method was found here:

Where I used the mail program built into my Ubuntu distribution already:

mail -a "$Filename64" -s "$Filename64" "$EmailAddr" < /dev/null

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .