Question

I am trying to send mail from a Linux command line using the mailx command. I can send from my local domain no problem but I want to set up mail to send from my Gmail account as well as receive mail sent to my Gmail account.

After configuring my mail.rc like so:

account gmail {
set smtp=smtps://smtp.gmail.com:587
set smtp-auth=login
set smtp-auth-user=USERNAME@gmail.com
set smtp-auth-password=PASSWORD
set ssl-verify=ignore
}

I would get the error:

Resolving host smtp.gmail.com . . . done.
Connecting to 74.125.25.109 . . . connected.
Missing "nss-config-dir" variable.
"/home/USERNAME/dead.letter" 11/354
. . . message not sent.

After looking up what the "nss-config-dir" was here, I located the certN.db and keyN.db files and added that to my mail.rc like so:

account gmail {
set smtp=smtps://smtp.gmail.com:587
set smtp-auth=login
set smtp-auth-user=USERNAME@gmail.com
set smtp-auth-password=PASSWORD
set ssl-verify=ignore
set nss-config-dir=/home/USER/.mozilla/firefox/LOCATION.default
}

now when I try to send mail using this command:

echo "sent from gmail account" | mailx -v -A gmail -s "Command line mail" SomeEmail@domain.com

I get this:

Resolving host smtp.gmail.com . . . done.
Connecting to 74.125.25.108 . . . connected.
COMMENT-->then it waits there for about 5 mins then spits out this:
SSL/TLS handshake failed: Unknown error -5938.
"/home/USER/dead.letter" 11/354
. . . message not sent.

Does anyone know how to either:
A) Set up mailx/mail.rc to access Gmail but ignore needing the nss-config-dir BS?
B) Set up mailx/mail.rc so that the nss-config-dir actually works?
C) Set up mailx/mail.rc to access Gmail in another way(POP maybe -don't know if that's an option, haven't looked into it?)

Any help would be super appreciated.

Was it helpful?

Solution 2

Thank you for this it gave me a way to find an even better solution. Supposedly these keyN.db and certN.db are databases of trusted certificate authorities.

I did a simple

find / -name "cert*.db"

to find where on my system has the keyN.db and certN.db files on my system (Fedora 20).
I found them under /etc/pki/nssdb/.

OTHER TIPS

Solved it!

There are 2 ways you can go about solving this.

  1. Go over here and follow user ndasusers answer. It will both create the keyN.db and certN.db files you need but also another one GMail SSL certificate that will solve another potential problem.
  2. Or you can just copy the keyN.db and certN.db into a folder (/etc/ssl/cert maybe) and direct mail.rc there like so:

    account gmail {
        set smtp=smtps://smtp.gmail.com:587
        set smtp-auth=login
        set smtp-auth-user=USERNAME@gmail.com
        set smtp-auth-password=PASSWORD
        set ssl-verify=ignore
        set nss-config-dir=/etc/ssl/cert
    }
    

Make sure you have permission to access those files if you are not root user, that buggered me up for a good while.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top