I'm trying to setup mailx to use my Gmail account. I've found a configuration that can send mail successfully but it requires me to store my email password in a configuration file in my home directory. I would like to be prompted for the password every time rather than storing it.

I've tried leaving out the smtp-auth-password field where the password is present but the program does not prompt for a password and instead gives me this error: User and password are necessary for SMTP authentication.

Is there any way configure mailx such that my email password is used in a secure manner?

Here is my mailx config file:

account gmail {
    set folder=imap://(removed)@imap.gmail.com
    set smtp-use-starttls
    set ssl-verify=ignore
    set smtp=smtp://smtp.gmail.com:587
    set smtp-auth=login
    set from=(removed)@gmail.com
    set smtp-auth-user=(removed)
    set smtp-auth-password=(removed)
    set nns-config-dir=~/.certs

Which version of mailx are you using?

heirloom-mailx 12.5 on Ubuntu 14.04 prompts me for the password every time if there's no smtp-auth-password setting in ~/.mailrc. This feature was added in 12.0 in March 2006 according to ChangeLog.

  • I am using Ubuntu 14.04 with heirloom-mailx 12.5. Jun 3 '15 at 12:42
  • It seems to be working now, must have just been a misconfiguration. However it is unusual that earlier it gave an error message indicating the password field must be supplied. Jun 3 '15 at 12:45
  • @ZeroKelvinKeyboard You can run as mailx -v to see debug output including full of SMTP AUTH activities.
    – yaegashi
    Jun 3 '15 at 13:14

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.