I was trying to send a mail from the shell script using the command
mailx -s "TEST MAIL" -c "user_name ..." user<message.txt
but it generates an error as unrecognized option -c ,the same happens if i
use -b as a option for blind copy, so what options do i need to use for cc and bcc here ???
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Debian and Ubuntu have replaced Heirloom mailx with s-nail mailx. Both support the -b and -c options. But there are other mailx commands from other packages which do not.
I suspect that you, too, are unknowingly using the GNU Mailutils mailx or the NMH mailx. The latter re-spells the -c option as -cc but has no equivalent for -b. The former has no direct equivalents for either, requiring that headers be injected using a generic mechanism. (Note that, strictly speaking, -b and -c control envelope not headers, although the distinction between them is blurry at the level of mailx.)
Further reading
mailx. Ubuntu 16.04 manual pages.mailx. Ubuntu 16.04 manual pages.mailx. Ubuntu 16.04 manual pages.mailx. Ubuntu 14.04 manual pages.s-nail. User commands. s-nail. Debian manual pages.mailx. User commands. GNU mail utils. Debian manual pages.mailx. General Commands Manual. BSD mailx. Debian manual pages.mailx. User commands. NMH. Debian manual pages.- Difference between mail and mailx?
- https://unix.stackexchange.com/a/469833/5132
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0