git GitLab 后缀配置邮件未发送
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19871196/
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
GitLab postfix configuration mail not sending
提问by Leandro Garcia
I installed GitLab on my Ubuntu 12.04 server. Now I can login as an Administrator, do some stuffs, however, my question is the email seems to be not workin. I need to confirm the confirmation email sent to my address.
我在我的 Ubuntu 12.04 服务器上安装了 GitLab。现在我可以以管理员身份登录,做一些事情,但是,我的问题是电子邮件似乎不起作用。我需要确认发送到我地址的确认电子邮件。
I installed postfix as per instruction by our the readme. How can I test my postfix or configure GitLab configuration.
我按照自述文件的说明安装了 postfix。如何测试我的 postfix 或配置 GitLab 配置。
回答by jojo
In case your ISP is blocking port 25 (this happens apparently quite often and was the case for me as well) you can use Gmail as a Relay. The following instructions are from hereand walk you step-by-step through the process:
如果您的 ISP 阻止了端口 25(这显然经常发生,对我来说也是如此),您可以使用 Gmail 作为中继。以下说明来自此处,可引导您逐步完成整个过程:
In /etc/postfix/main.cf
add:
另外/etc/postfix/main.cf
:
# Relaying Postfix SMTP via GMAIL
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes
Then you need to setup the Gmail credentials. For this open/create /etc/postfix/sasl_passwd
and write:
然后您需要设置 Gmail 凭据。为此打开/创建/etc/postfix/sasl_passwd
和写入:
[smtp.gmail.com]:587 [email protected]:PASSWORD
Where (as you might have guessed) USERNAME
and PASSWORD
are your credentials. Then change permissions for the file:
在哪里(正如您可能已经猜到的)USERNAME
以及PASSWORD
您的凭据。然后更改文件的权限:
$ sudo chmod 400 /etc/postfix/sasl_passwd
$ sudo postmap /etc/postfix/sasl_passwd
Now we need to add the certificate to Postfix:
现在我们需要将证书添加到 Postfix:
$ cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem
Just restart postfix and you should be good:
只需重新启动 postfix 就可以了:
$ sudo service postfix restart
If you want to test:
如果你想测试:
$ echo "Hello World" | mail -s "Test Message" [email protected]
And check what the mail log thinks about it:
并检查邮件日志对此的看法:
$ tail /var/log/mail.log
Note: You only have 500 emails per day using Gmail's SMTP Server as Relay.
注意:使用 Gmail 的 SMTP 服务器作为中继,您每天只有 500 封电子邮件。
回答by Bruno Camarneiro
I've had the same issue with the same OS but on VMWare.
我在相同的操作系统上遇到了同样的问题,但在 VMWare 上。
How I solved it: 1 - Checked this post and checked step 3 from user3085707's answer:
我是如何解决的: 1 - 检查了这篇文章并检查了 user3085707 的回答中的第 3 步:
try from command line to send a email and check your logs http://www.simplehelp.net/2008/12/01/how-to-send-email-from-the-linux-command-line/
尝试从命令行发送电子邮件并检查您的日志http://www.simplehelp.net/2008/12/01/how-to-send-email-from-the-linux-command-line/
2 -"mail" command was not installed and ubuntu said:
2 -“mail”命令没有安装,ubuntu 说:
The program 'mail' is currently not installed. You can install it by typing: sudo apt-get install mailutils
当前未安装“邮件”程序。您可以通过键入以下内容来安装它:sudo apt-get install mailutils
So I did it ("Ubuntu should know what he is doing", I thought).
所以我做到了(“Ubuntu 应该知道他在做什么”,我想)。
3 - In the next settings I selected "Internet site" (or something like it) and entered a domain (in my case I used "code.repo");
3 - 在接下来的设置中,我选择了“互联网站点”(或类似的东西)并输入了一个域(在我的例子中我使用了“code.repo”);
4 - Tested "mail" command. It was working (even though the mail was sent to the spam folder);
4 - 经过测试的“邮件”命令。它正在工作(即使邮件被发送到垃圾邮件文件夹);
5 - Created new user in Gitlab. Checked my mail.
5 - 在 Gitlab 中创建新用户。检查了我的邮件。
6 - Thanked the almighty Ubuntu for the tip.
6 - 感谢全能的 Ubuntu 的提示。
回答by Kokopikos
Can be many reasons for you problem..
你的问题可能有很多原因..
- check your mail log (more /var/log/mail.log)
- if you use iptables make sure that you dont blocking port 25 (sudo ufw allow 25)
- try from command line to send a email and check your logs http://www.simplehelp.net/2008/12/01/how-to-send-email-from-the-linux-command-line/
- Check with your ISP, may blocking the port 25
- 检查您的邮件日志(更多 /var/log/mail.log)
- 如果您使用 iptables,请确保您没有阻塞端口 25 (sudo ufw allow 25)
- 尝试从命令行发送电子邮件并检查您的日志 http://www.simplehelp.net/2008/12/01/how-to-send-email-from-the-linux-command-line/
- 请咨询您的 ISP,可能会阻止端口 25