使用postfix发送邮件,需要你对本身配置做些修正,另外,也需要你设置相应的DNS,否则发送邮件会容易当做垃圾邮件。

我们做几个步骤来看看收信的影响:

1 安装后不设置
2 设置hostname和domain
3 设置MX记录
4 设置SPF

以下说明的信息为了去除隐私信息,做过一些名称修改:

= 1 没有任何配置 =

引用
Delivered-To: your-email@gmail.com
Received: by 10.114.181.20 with SMTP id d20cs1238waf;
        Mon, 4 Jan 2010 17:33:21 -0800 (PST)
Received: by 10.141.90.17 with SMTP id s17mr7576023rvl.196.1262655201126;
        Mon, 04 Jan 2010 17:33:21 -0800 (PST)
Return-Path:
Received: from localhost.localdomain ([219.232.1.2])
        by mx.google.com with ESMTP id 20si58728702pwj.8.2010.01.04.17.33.18;
        Mon, 04 Jan 2010 17:33:19 -0800 (PST)
Received-SPF: neutral (google.com: 219.232.1.2 is neither permitted nor denied by best guess record for domain of root@localhost.localdomain) client-ip=219.232.1.2;
Authentication-Results: mx.google.com; spf=neutral (google.com: 219.232.1.2 is neither permitted nor denied by best guess record for domain of root@localhost.localdomain) smtp.mail=root@localhost.localdomain
Received: by localhost.localdomain (Postfix, from userid 0)
  id 7BF5120DF2C; Mon,  4 Jan 2010 21:33:09 -0500 (EST)
To: your-email@gmail.com
Subject: test in 95
Message-Id: <20100105023309.7BF5120DF2C@localhost.localdomain>
Date: Mon,  4 Jan 2010 21:33:09 -0500 (EST)
From: root@localhost.localdomain (root)

test


我们看到,发信人是root@localhost.localdomain,明显不对的
回复邮件也肯定收不到,我们至少需要用户能够回复,当然,除非你不想。

= 2 设置hostname和domain =

postconf -e "myhostname=aslibra.com"
postconf -e "mydomain=mail.aslibra.com"
postfix reload


postfix里面修改参数可以用以上的方式,检查参数
可以是 postconf myhostname

引用
Delivered-To: your-email@gmail.com
Received: by 10.114.181.20 with SMTP id d20cs2044waf;
        Mon, 4 Jan 2010 17:52:44 -0800 (PST)
Received: by 10.142.2.14 with SMTP id 14mr7796472wfb.93.1262656364099;
        Mon, 04 Jan 2010 17:52:44 -0800 (PST)
Return-Path:
Received: from aslibra.com ([219.232.1.2])
        by mx.google.com with ESMTP id 4si15052142pwj.24.2010.01.04.17.52.43;
        Mon, 04 Jan 2010 17:52:43 -0800 (PST)
Received-SPF: neutral (google.com: 219.232.1.2 is neither permitted nor denied by best guess record for domain of root@aslibra.com) client-ip=219.232.1.2;
Authentication-Results: mx.google.com; spf=neutral (google.com: 219.232.1.2 is neither permitted nor denied by best guess record for domain of root@aslibra.com) smtp.mail=root@aslibra.com
Received: by aslibra.com (Postfix, from userid 0)
  id 9AB3420DF2F; Mon,  4 Jan 2010 21:52:34 -0500 (EST)
To: your-email@gmail.com
Subject: test after modify myhostname and mydomain
Message-Id: <20100105025234.9AB3420DF2F@aslibra.com>
Date: Mon,  4 Jan 2010 21:52:34 -0500 (EST)
From: root@aslibra.com (root)

test


看到了吧?
发信人是 root@aslibra.com 了,这用户至少知道是谁发的
如果用户回复邮件,那就会发到aslibra.com指定的邮件服务器,这个是通过DNS查询判断发送到哪里的。
下面来修改DNS:

= 3 设置DNS =

添加一条MX记录:@ MX mail.aslibra.com.
再添加一条A记录: mail A your_IP
一般建议不直接指向IP

收到的邮件无变化,忽略邮件说明。

= 4 设置SPF =

细心的话,可以看的出来,gmail有一段信息:

引用
Received-SPF: neutral (google.com: 219.232.1.2 is neither permitted nor denied by best guess record for domain of root@aslibra.com) client-ip=219.232.1.2;
Authentication-Results: mx.google.com; spf=neutral (google.com: 219.232.1.2 is neither permitted nor denied by best guess record for domain of root@aslibra.com) smtp.mail=root@aslibra.com


SPF是什么?

引用
SPF 是发送方策略框架
  (Sender Policy Framework) 的缩写,一种以IP(互联网协定)地址认证电子邮件寄件人身份的技术,是非常高效的垃圾邮件解决方案,旨在应对垃圾邮件中的一个特别问题——发送方假冒问题。当用户定义了他的域名SPF记录之后,接收邮件方会根据该用户的SPF记录来确定连接过来的IP地址是否被包含在SPF记录里面,如果在,则认为是一封正确的邮件,否则则认为是一封伪造的邮件。因此,那些发信人伪造域名的垃圾邮件在SPF的火眼金睛下再也无法隐藏,企业邮箱就可以有效地避免此类垃圾邮件。


设置SPF可以有简单的方法:
http://old.openspf.org/wizard.html

DNS添加一条TXT记录:

v=spf1 mx a:mail.aslibra.com ~all


邮件会不一样:

引用
Delivered-To: your-email@gmail.com
Received: by 10.114.181.20 with SMTP id d20cs2325waf;
        Mon, 4 Jan 2010 17:58:31 -0800 (PST)
Received: by 10.141.100.8 with SMTP id c8mr13115112rvm.201.1262656711500;
        Mon, 04 Jan 2010 17:58:31 -0800 (PST)
Return-Path:
Received: from aslibra.com ([219.232.1.2])
        by mx.google.com with ESMTP id 35si27159111pxi.23.2010.01.04.17.58.30;
        Mon, 04 Jan 2010 17:58:30 -0800 (PST)
Received-SPF: pass (google.com: domain of root@aslibra.com designates 219.232.1.2 as permitted sender) client-ip=219.232.1.2;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of root@aslibra.com designates 219.232.1.2 as permitted sender) smtp.mail=root@aslibra.com
Received: by aslibra.com (Postfix, from userid 0)
  id 8C66C20DF2F; Mon,  4 Jan 2010 21:58:21 -0500 (EST)
To: your-email@gmail.com
Subject: test after setting SPF
Message-Id: <20100105025821.8C66C20DF2F@aslibra.com>
Date: Mon,  4 Jan 2010 21:58:21 -0500 (EST)
From: root@aslibra.com (root)

test


也就是通过了SPF检查,这样一般的邮件服务器都不会认为你的是垃圾邮件,除非很多人举报你。
当然,能够设置PTR记录就更加完美了。


原创内容如转载请注明:来自 阿权的书房
收藏本文到网摘
Tags: , , ,
发表评论
AD
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML 打开UBB 打开表情 隐藏
昵称   密码   游客无需密码
网址   电邮   [注册]
               

验证码 不区分大小写
 

阅读推荐

服务器相关推荐

开发相关推荐

应用软件推荐