当我搜索配置在Ubuntu的sendmail我没有得到任何明确的答案,他们每个人都假设我知道他们在说什么,sendmail:如何在Ubuntu上配置sendmail?
我只想基本配置,以启用电子邮件发送,基本上我会用它与谷歌应用程序引擎启用邮件从开发服务器发送。
我已经这样做:
sudo apt-get install sendmail
然后
sudo sendmailconfig
,但我不知道是什么,最后一个实际上没有。
当我搜索配置在Ubuntu的sendmail我没有得到任何明确的答案,他们每个人都假设我知道他们在说什么,sendmail:如何在Ubuntu上配置sendmail?
我只想基本配置,以启用电子邮件发送,基本上我会用它与谷歌应用程序引擎启用邮件从开发服务器发送。
我已经这样做:
sudo apt-get install sendmail
然后
sudo sendmailconfig
,但我不知道是什么,最后一个实际上没有。
当您在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 [email protected]
下面将让你的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
):
m4 sendmail.mc > sendmail.cf
重新启动sendmail守护程序:
service sendmail restart
我得到最多的回答工作(不能答复还)经过一次小小的编辑
这不适合我:
FEATURE('authinfo','hash /etc/mail/auth/client-info')dnl
每个字符串的第一个单引号改为反引号(')是这样的:
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl
的变化后,我跑:
sudo sendmailconfig
而且我在业务:)
结合上面的两个答案,我终于使它的工作。请注意,每个字符串的第一个单引号是文件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
我仍然有问题来理解行AuthInfo ...你可以举一个例子。 .. – 2014-02-20 15:47:47
例如,我的客户端信息只有一行,'AuthInfo:smtp.gmail.com'U:username“”P:password“' – flyrain 2014-02-20 18:36:01
仍然包含所有这些设置和AuthInfo我落入垃圾邮件列表 使用smtp.gmail.com与google.admin中的现有帐户 AuthInfo:smtp.gmail。com“U:root”“I:[email protected]”“P:password” 也试过 AuthInfo:smtp-relay.gmail.com“U:root”“I:[email protected]”“P:密码“ – 2016-03-23 15:25:25
@ThiefMaster是否我们不再将问题迁移到相应的SE网站? – Michael 2014-12-03 22:58:25
这个问题太老了,无法迁移(当我关闭它时它已经是如此)。 – ThiefMaster 2014-12-03 23:01:59
这些答案都不适合我。我发现这篇适合我的在线文章:http://www.daveperrett.com/articles/2013/03/19/setting-up-sendmail-with-sendgrid-on-ubuntu/ – 2016-07-22 18:42:55