You cannot change the values of some environment variables, such as HOME and MAILRC, from within mailx. You tried to change the value of such a variable.
Do not try to change the value of read-only variables.