Linux Mailx 和 Gmail nss 配置目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16799407/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Mailx and Gmail nss config dir
提问by Jeff
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.
我正在尝试使用 mailx 命令从 Linux 命令行发送邮件。我可以从我的本地域发送没问题,但我想设置邮件从我的 Gmail 帐户发送以及接收发送到我的 Gmail 帐户的邮件。
After configuring my mail.rc like so:
像这样配置我的 mail.rc 之后:
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:
查找什么“NSS-配置-目录”是经过这里,我所在的certN.db和keyN.db文件,并补充说,我mail.rc像这样:
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?)
有谁知道如何:
A) 设置 mailx/mail.rc 以访问 Gmail 但忽略需要 nss-config-dir BS?
B) 设置 mailx/mail.rc 以便 nss-config-dir 实际工作?
C) 设置 mailx/mail.rc 以另一种方式访问 Gmail(POP 可能 - 不知道这是否是一个选项,还没有研究过?)
Any help would be super appreciated.
任何帮助将不胜感激。
采纳答案by penguinjeff
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.
谢谢你,它让我找到了一个更好的解决方案。据说这些keyN.db
和certN.db
是受信任的证书颁发机构的数据库。
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/
.
在我的系统上找到keyN.db
和certN.db
文件(Fedora 20)。
我在/etc/pki/nssdb/
.
回答by Jeff
Solved it!
解决了!
There are 2 ways you can go about solving this.
有两种方法可以解决这个问题。
- Go over hereand follow user
ndasusers
answer. It will both create thekeyN.db
andcertN.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
andcertN.db
into a folder (/etc/ssl/cert maybe
) and directmail.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 }
- 去这里并按照用户的
ndasusers
回答。这都将建立keyN.db
和certN.db
您需要将解决另一个潜在的问题的文件,但还另有一个GMail的SSL证书。 或者,您可以将
keyN.db
和复制certN.db
到一个文件夹 (/etc/ssl/cert maybe
) 中,然后mail.rc
像这样直接指向那里: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.
如果您不是root
用户,请确保您有权访问这些文件,这让我困扰了很长时间。