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.
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/
.