-1

I am new to mailx and try now to send a mail with mailx from the terminal which contains a text and an attachment. This is my command:

echo "This is the text in Mail" | mailx -A data.out -s "TESTMAIL" my_name@my_insitute.com

I looked up the manual which says I need to use the -A and not the -a for an attachment. But now mailx does not send my text anymore. Just the attached file. But I want both. What is my mistake?

Andrea
  • 105
  • 2
  • The manual page I have for `mailx` (version 12.5) says that `-a` is for attachment and `-A` `Executes an account command for name after the startup files have been read.`. – larsks May 31 '22 at 12:34
  • @larsks I looked it up because I found a lot of webpages which says I should use `-a` but then I get the error that something is wrong with the header. When I use `-A` then I can send the attachment but not the text. – Andrea May 31 '22 at 12:37
  • Lots of info at https://stackoverflow.com/q/17359/7552 -- there;s at least one answer that details the different flavours of mailx and talks about -a vs -A – glenn jackman May 31 '22 at 12:49
  • @glennjackman thanks but also with this commands I get the file OR the text. They also say that if you use Ubuntu, like I do, you have to use the `-A`command. Also I can not install mutt to try the other commands caus the server is running by admin. And he will not install mutt or other programs. I have to work it out with `mailx` – Andrea May 31 '22 at 13:09
  • Does this answer your question? [Sending attachments with mailx and uuencode](https://stackoverflow.com/questions/24303201/sending-attachments-with-mailx-and-uuencode) and tons of other questions on that exact subject. – Nic3500 Jun 01 '22 at 02:21
  • @Nic3500 The question is why does it work with them an not with me? Because I give the same command in the terminal as the person on the link. And I do not get the body in the mail – Andrea Jun 01 '22 at 07:58
  • Ah gotcha. Add `-v` option to your mailx command, and post the output here, we might see something to explain why. – Nic3500 Jun 01 '22 at 16:11

0 Answers0