0

I want to send an email from Linux with body and attachment. However, it only sends either one of the two. When I have both in the command, only the attachment is sent. I'm working with a log file as body and a CSV file as an attachment. I have tried the following;

mail -a "FROM: Name <name@email.com>" -s "subject of email" "recipient@email.com" -A /home/Export/attachment.csv <<< "$BODY_SUCCES"

For which the variable $BODY_SUCCESS is a log file. I have also tried making it work with mutt and mailx, but neither seemed to work, unfortunately. I can't figure out what's going wrong here. Can anyone help?

  • The thing after `<< – tripleee Jun 17 '21 at 12:27
  • Duplicate of https://stackoverflow.com/questions/8314999/sending-simple-message-body-file-attachment-using-linux-mailx – tripleee Jun 17 '21 at 12:29
  • Tangentially, [perhaps don't use upper case for your private variables.](https://stackoverflow.com/questions/673055/correct-bash-and-shell-script-variable-capitalization) – tripleee Jun 17 '21 at 12:31
  • Does this answer your question? [Sending simple message body + file attachment using Linux Mailx](https://stackoverflow.com/questions/8314999/sending-simple-message-body-file-attachment-using-linux-mailx) – bad_coder Jun 17 '21 at 18:22

0 Answers0