When entering personal preferences like retain me@example.com inside command line mail, how can I have these saved so they are reloaded the next time I start mail?


There is no direct way to save the current settings. Instead, you have to write the desired settings to the user startup file, ~/.mailrc.

This is referenced in the manual page for mailx (see man mailx), which says,

At startup time, mail will execute commands in the system command file, /etc/mail.rc, unless explicitly told not to by using the -n option. Next, the commands in the user's personal command file ~/.mailrc are executed. mail then examines its command line options [...]

Here is an example, taken straight from /etc/mail.rc on my (Debian) system. As you can see the syntax is identical to that used on the command line:

set ask askcc append dot save crt
ignore Received Message-Id Resent-Message-Id Status Mail-From Return-Path Via Delivered-To
  • I assume then that the syntax used in .mailrc is identical to the one entered directly on the command line. – forthrin May 18 '18 at 13:03
  • @forthrin yes. I've amended my answer to address this explicitly – roaima May 18 '18 at 13:06

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.