sendmail:如何在Ubuntu上configurationsendmail?

当我在Ubuntu上searchconfigurationsendmail时,我没有得到任何明确的答案,他们每个人都假设我知道他们在说什么,

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

我已经这样做了:

sudo apt-get install sendmail 

然后

 sudo sendmailconfig 

但我不知道最后一个实际做了什么。

当你inputsudo sendmailconfig ,应该提示你configurationsendmail。

作为参考,configuration期间更新的文件位于以下位置(以防您手动更新):

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

您可以通过在命令行中键入以下内容来testingsendmail是否正确configuration并进行设置:

 $ 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 .. 

MAILERDEFINITIONS添加到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 

调用创buildsendmail.cf(或运行make ):

 m4 sendmail.mc > sendmail.cf 

重新启动sendmail守护进程:

 service sendmail restart 

我得到了最好的答案工作(还不能答复)后一个小编辑

这不适合我:

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

每个string的第一个单引号应该改成反引号(`),像这样:

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

改变后我运行:

 sudo sendmailconfig 

而我在做生意:)

结合上面的两个答案,我终于使它的工作。 只要注意, 每个string的第一个单引号是 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