(Note: I have seen this question, but it does not work for me)
I am attempting to send an email with an attachment using Bash on Debian Stretch, using the
mailx package (not mutt). My implementation does not support the
-A parameter (it's an invalid option), and the
-a parameter is for adding headers.
I have tried many variations of the following, but they fail for me:
mail -s "Test" -a /home/user/filename.xlsx firstname.lastname@example.org < /root/emailbody.txt
The end effect is a plain-text email with the filename as the first line, the header content, then the data inside
/home/user/filename.xlsx MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Hi there
I do not have
uuencode, and many threads are reporting that's the "old" way of sending attachments. I cannot install
mutt on this server. What are my options?
Update with uuencode - I tried running it as the following, but only got "Hi there" as the email result, no attachment:
uuencode /home/user/filename.xlsx test.tlsx | mail -s "Test" email@example.com < /root/emailbody.txt