0

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 ???

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

  • See the thing is none of the mail service was pre installed on ubuntu,I explicitly installed gnu mailutils ,so what you suggest in my case ???? – Noshiii Dec 17 '18 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.