'Linux mail: when i try to send attachment body is also attachment

i try to send a mail from a bash script with the following code

notify_by_mail () {

echo "TEST BODY" | mail --attach=$LOG_PATH -aFROM:$1 -s "Borg backup failed" $2

}

The problem is, what I try to echo to mail is also handled as an attachment but I want to have it as the body. When I dont send an attachment it behaves like I would. Could anyone please tell me whats going wrong?

It tried around with mail and searched long for the options but I cant figure out what I do wrong.

Thanks a lot!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source