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 [email protected]
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 [email protected]
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" [email protected]
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.
Solved it!
There are 2 ways you can go about solving this.
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.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 [email protected]
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.