sendmail的:如何在Ubuntu上配置sendmail? [关闭] sendmail的:如

2019-05-13 16:42发布

当我搜索了在Ubuntu我din't得到任何明确的答案配置sendmail的,他们每个人都假定我知道他们在说什么,

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

我已经做了这一点:

sudo apt-get install sendmail

然后

sudo sendmailconfig

但我不知道最后一个实际上没有。

Answer 1:

当您在输入sudo sendmailconfig ,你应该已经提示配置sendmail。

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

/etc/mail/sendmail.conf
/etc/cron.d/sendmail
/etc/mail/sendmail.mc

您可以测试sendmail来查看是否配置正确,通过键入以下到命令行设置它:

$ echo "My test email being sent from sendmail" | /usr/sbin/sendmail myemail@domain.com

下面将让你的SMTP中继添加到sendmail的:

#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服务器。

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

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

m4 sendmail.mc > sendmail.cf

重新启动sendmail守护程序:

service sendmail restart


Answer 2:

我之后的一个小编辑得到最多的回答工作(还不能回复)

这并没有为我工作:

FEATURE('authinfo','hash /etc/mail/auth/client-info')dnl

每个串中的第一单引号应该被改变为反引号(')是这样的:

FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl

变更后我运行:

sudo sendmailconfig

而我在业务:)



Answer 3:

结合上述两个答案,我终于使它工作。 只是要小心, 对于每个字符串的第一个单引号是反引号(`)文件sendmail.mc。

#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


文章来源: sendmail: how to configure sendmail on ubuntu? [closed]