首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >sendmail:如何在ubuntu上配置sendmail?

sendmail:如何在ubuntu上配置sendmail?
EN

Stack Overflow用户
提问于 2012-04-28 08:21:40
回答 3查看 568K关注 0票数 190

当我在ubuntu上搜索配置sendmail时,我没有得到任何明确的答案,每个人都认为我知道他们在说什么,

我只想要基本的配置来启用电子邮件发送,基本上我会使用它与谷歌应用程序引擎,以启用邮件发送从开发服务器。

我已经这样做了:

代码语言:javascript
复制
sudo apt-get install sendmail

然后

代码语言:javascript
复制
sudo sendmailconfig

但我不知道最后一个到底做了什么。

EN

回答 3

Stack Overflow用户

发布于 2012-04-28 08:35:46

当您键入sudo sendmailconfig时,系统会提示您配置sendmail。

作为参考,在配置过程中更新的文件位于以下位置(如果您希望手动更新它们):

代码语言:javascript
复制
/etc/mail/sendmail.conf
/etc/cron.d/sendmail
/etc/mail/sendmail.mc

您可以通过在命令行中键入以下内容来测试sendmail,以查看它是否已正确配置和设置:

代码语言:javascript
复制
$ echo "My test email being sent from sendmail" | /usr/sbin/sendmail myemail@domain.com

下面将允许您将smtp中继添加到sendmail:

代码语言:javascript
复制
#Change to your mail config directory:
cd /etc/mail

#Make a auth subdirectory
mkdir auth
chmod 700 auth

#Create a file with your auth information to the smtp server
cd auth
touch client-info

#In the file, put the following, matching up to your smtp server:
AuthInfo:your.isp.net "U:root" "I:user" "P:password"

#Generate the Authentication database, make both files readable only by root
makemap hash client-info < client-info
chmod 600 client-info
cd ..

将以下行添加到sendmail.mc中,但在MAILERDEFINITIONS之前。请确保更新您的smtp服务器。

代码语言:javascript
复制
define(`SMART_HOST',`your.isp.net')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash -o /etc/mail/auth/client-info.db')dnl

调用creation sendmail.cf (或者运行make -C /etc/mail):

代码语言:javascript
复制
m4 sendmail.mc > sendmail.cf

重新启动sendmail守护进程:

代码语言:javascript
复制
service sendmail restart
票数 150
EN

Stack Overflow用户

发布于 2012-10-10 04:46:34

我得到了顶部的答案工作(还不能回复)后,一个小编辑

这对我不起作用:

代码语言:javascript
复制
FEATURE('authinfo','hash /etc/mail/auth/client-info')dnl

每个字符串的第一个单引号应改为反引号(`),如下所示:

代码语言:javascript
复制
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl

在更改之后,我运行:

代码语言:javascript
复制
sudo sendmailconfig

我在做生意:)

票数 35
EN

Stack Overflow用户

发布于 2014-01-09 01:41:25

结合上面的两个答案,我终于让它工作了。只需注意,在文件sendmail.mc中,每个字符串的第一个单引号是一个反引号(`)。

代码语言:javascript
复制
#Change to your mail config directory:
cd /etc/mail

#Make a auth subdirectory
mkdir auth
chmod 700 auth  #maybe not, because I cannot apply cmd "cd auth" if I do so.

#Create a file with your auth information to the smtp server
cd auth
touch client-info

#In the file, put the following, matching up to your smtp server:
AuthInfo:your.isp.net "U:root" "I:user" "P:password"

#Generate the Authentication database, make both files readable only by root
makemap hash client-info < client-info
chmod 600 client-info
cd ..

#Add the following lines to sendmail.mc. Make sure you update your smtp server
#The first single quote for each string should be changed to a backtick (`) like this:
define(`SMART_HOST',`your.isp.net')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl

#run 
sudo sendmailconfig
票数 14
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10359437

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档