Wishlist 0 ¥0.00

关于MX记录的问题 问题

关于MX记录

解决方案
域名解析主要有4个主要类型:
NS DNS
MX 邮件
A IP地址
CNAME 别名

除了A记录,其他3个类型都是要解析到主机名的。
比如:
...
IN MX 0 mail
IN MX 10 mail.yourdomain.com.
...

我们来看一个邮件服务器在发信的时候,是怎么判断发送到那里的过程。
某邮件服务器要把一份邮件发送到This email address is being protected from spambots. You need JavaScript enabled to view it.的信箱。
此时,他会做两次DNS查询。
第一次,先查询yourname.com的mx记录,查出mx记录对应的主机名之后,再查询这个主机名对应的IP。
然后再将邮件发送到IP。
这个过程可以用dig命令模拟。
第一步:
dig +short yehglobal.com mx
结果:
0 mail.yehglobal.com.
10 mail.yehglobal.com.
第二步:
dig +short mail.yehglobal.com
结果:
210.78.128.66

有的服务商,错误地把mx记录直接解析到了IP地址。大部分的邮件服务器可以正常工作,但是会提示错误:Warning: numeric address in MX record!。
有的邮件服务器可能就会把IP地址当作一个主机名,致使邮件发不出去。

我们再来看有关mx记录的其他要注意的地方。
1. 多条mx记录
在刚才的例子中,我们看到,查询mx记录时返回了两条记录:
0 mail.yehglobal.com.
10 mail.yehglobal.com.
其中的0和10代表优先级,数越小,优先级越高。多条mx记录,一般情况下,是说邮件可以按顺序发送到这些主机,有的时候,多条记录可能是相同的(例子中的情况),
这是为了增加冗余和重试次数。
2. 相对主机名和绝对主机名
...
MX IN 0 mail
MX IN 10 mail.otherdomain.com.
...
这个例子中,一个记录是mail,另一条记录是mail.yourdomain.com.,第一条最后没有“.”字符的记录是相对主机名,实际上会被加上这个域名,
变成:mail.yourdomain.com.;第二条记录最后有“.”字符,代表一个绝对主机名,不会被转换。

综上所述,一般情况下,如果要解析一个域名的邮件记录,发送到某个IP,会在域名解析中解两条记录:
IN MX 0 mail
mail IN A 10.0.0.1

*** 如何在Prim@Hosting系统中,设置一个域名的邮件发送到另外一台服务器 ***
在使用Prim@Hosting系统的时候,在创建站点时,可以指定mail解析到哪个IP,在dns mx记录的框里填写另外服务器的IP地址就可以;
也可以使用子域名管理工具,在mail子域的A记录的框内填写另外服务器的IP地址。

*** 如何检验域名解析的正确 ***
使用dig命令。指定DNS服务器:
dig @dns1.yourname.com abc.com mx
dig @dns1.yourname.com mail.abc.com

MX-Records (Mail exchange)

MX-records are used to specify the e-mail server(s) responsible for a domain name.

Each MX-record points to the name of an e-mail server and holds a preference number for that server.

If a domain name is handled by multiple e-mail servers (for backup/redundancy), a separate MX-record is used for each e-mail server, and the preference numbers then determine in which order (lower numbers first) these servers should be used by other e-mail servers.

If a domain name is handled by a single e-mail server, only one MX-record is needed and the preference number does not matter.

When sending an e-mail to "This email address is being protected from spambots. You need JavaScript enabled to view it.", your e-mail server must first look up any MX-records for "example.com" to see which e-mail servers handles incoming e-mail for "example.com".

This could be "mail.example.com" or someone else's mail server like "mail.isp.com".

After this it looks up the A-record for that e-mail server name to connect to its IP-address.

Do not point an MX-record to a CNAME-record. Many e-mail servers don't understand this. Add another A-record instead.

 

This record type is defined in RFC1035.

设置hmailserver的公共主机名

Public Host Name for this Computer in Settings

  •  

Post by mansonasp » 2007-09-08 00:05

This one probably seems a bit dumb. I have installed Hmailserver on a private machine in the data centre. The domain is http://www.nevasoftware.com and the MX records for it point to the IP address of my server however himailserver is warning me that:

You haven't specified the public host name for this computer in the SMTP settings.

However I cannot tell where to go within Administration to accomplish this. Help appreciated.

:(
 
g0yjs0
Senior user
Senior user
Posts: 282
Joined: 2006-01-26 10:18

 

  •  

Post by g0yjs0 » 2007-09-08 01:23

Open hMailServer Administrator.
Go to: Settings | Protocols | SMTP.
Click on the "Delivery of e-mail" tab.
Fill-in the "hostname" field.
 
hmale
New user
New user
Posts: 1
Joined: 2008-05-06 02:14

Re: Public Host Name for this Computer in Settings

  •  

Post by hmale » 2008-05-06 02:17

Is the Public Host name supposed to be the public ip of the hmail server or the hostname please?

Thanks
Hmale
User avatar
mattg
Moderator
Moderator
Posts: 21248
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Public Host Name for this Computer in Settings

  •  

Post by mattg » 2008-05-06 02:29

hmale wrote:Is the Public Host name supposed to be the public ip of the hmail server or the hostname please?
Perhaps you could check the documentation, after all that's why it is there.

Matt
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation
 
schram12
New user
New user
Posts: 1
Joined: 2010-12-31 20:42

Re: Public Host Name for this Computer in Settings

  •  

Post by schram12 » 2010-12-31 20:48

:shock: I thought this was a forum for asking such questions. If the documentation was written for all levels of user, this forum would not be necessary.

Obviously the public host name is placed in this field. But, I believe he is asking where does one get the public host name? This is not covered in the documentation as it is probably somewhat public knowledge. Unfortunately, only a small part of the public has this knowledge.

I would like to ask the same question. Any answers?
 
Bill48105
Developer
Developer
Posts: 6192
Joined: 2010-04-24 23:16
Location: Michigan, USA

Re: Public Host Name for this Computer in Settings

  •  

Post by Bill48105 » 2010-12-31 21:33

schram12,
The thread was over 2 years old so I have a feeling everyone had moved on.. :D It is always best to create your own thread & link to this thread or others you think might be related/helpful..

Anyhow IMO: I have a feeling if one plans to run a mail server they should have a clue what a host name is, how to get/set it etc. ;)

Now to answer your question: normally YOU set your hostname in DNS.. Usually there is a web admin you log into & create records. Normally you add an A record where you define your HOST NAME for your mail server. Like mail.yourdomain.com or smtp.yourdomain.com or whatever.yourdomain.com. Then you create MX record with that HOST NAME and some priority # which often people default to 10 but doesn't really matter so much especially if you only make 1 MX record.

So the answer is you SET your hostname yourself normally & should know it like your own name.. Btw technically your domain name is your root/base host name & could USUALLY be used depending on your setup. If you don't run your DNS yourself or have access to an admin then either your ISP (or whoever manages it for you) likely creates default host names or dns records you use or you contact them to ask them what they are or set but think that setup is quite rate as most hosts/isps want you to be self-sufficient as labor/support is costly to them.

Also, if your reverse dns ptr is setup properly (as commonly accepted) you should be able to get your hostname by typing from CMD prompt:
nslookup YOUR.PUBLIC.IP.ADDRESS <ENTER>

That is because it is best practice (as in commonly accepted but not 'law') to contact your ISP & ask them to set it to resolve to your hostname. If you haven't done so then odds are that nslookup would likely be some random host name that follows some pattern, likely with your IP used somehow and often your mail will be blocked/filtered if left that way.

Anyway hopefully that answers the host name questions thoroughly but to be honest anyone should have been able to find all of the above in 10-30 seconds with google & a little effort vs 15 minutes of me or someone else here volunteering to type out readily available info. (Granted I ramble & make 2 min reply turn into 15 but that is besides the point. lol) Yes the forum is helpful to fill in the gaps where docs/searches come up short but maybe try to show a little effort in covering the basics before posting eh. ;)

Well nuff ranting. lol Happy New Year and cheers!
Bill
hMailServer build LIVE on my servers: 5.4-B2014050402
#hmailserver on FreeNode IRC https://webchat.freenode.net/?channels=#hmailserver
*** ABSENT FROM hMail! Those in IRC know how to find me if urgent. ***
 
^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: Public Host Name for this Computer in Settings

  •  

Post by ^DooM^ » 2010-12-31 22:02

Image
If at first you don't succeed, bomb disposal probably isn't for you! ヅ
User avatar
mattg
Moderator
Moderator
Posts: 21248
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Public Host Name for this Computer in Settings

  •  

Post by mattg » 2011-01-01 03:33

schram12 wrote::shock: I thought this was a forum for asking such questions. If the documentation was written for all levels of user, this forum would not be necessary.

Obviously the public host name is placed in this field. But, I believe he is asking where does one get the public host name? This is not covered in the documentation as it is probably somewhat public knowledge. Unfortunately, only a small part of the public has this knowledge.

I would like to ask the same question. Any answers?
And now for my favourite link in all of the documentation...

Please see technical knowledge at the bottom of this page http://www.hmailserver.com/documentatio ... quirements

As Bill says
Bill48105 wrote:So the answer is you SET your hostname yourself normally & should know it like your own name.. Btw technically your domain name is your root/base host name & could USUALLY be used depending on your setup.
Something like 'mail.yourdomain.com' is usually adequate.

BTW I think I answered the OP's question, and linked to the appropriate page of the documentation.
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation
 
maxunique
New user
New user
Posts: 5
Joined: 2018-03-29 13:19

Re: Public Host Name for this Computer in Settings

  •  

Post by maxunique » 2018-03-29 13:24

What does it mean SMTP hostname?

I have 3 multiple IPs on the same dedicated server and I want to setup 3 SMTP relays (1 for each IP).

What exactly does the hostname mean? Public DNS name? Then I have 3 different (1 per IP).

Thanks
User avatar
mattg
Moderator
Moderator
Posts: 21248
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Public Host Name for this Computer in Settings

  •  

Post by mattg » 2018-03-29 15:32

Please start a new thread as per forum rules...

Consider these points in your new thread.

What are you wanting to do, accept mail on three IPs OR send mail from one of three IPS, depending on the sender?
Why do you want to use 3 public IPs?

When you say 'SMTP HOSTNAME' where exactly are you seeing that? I can't see any such named field, but many similarly named fields. Depends on where will change the answer, but typically hostname is literally a FQDN Hostname, like 'mail.example.com'
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

SPF 记录:原理、语法及配置方法简介

SPF,全称为 Sender Policy Framework,即发件人策略框架。

当前 Email 通信,还是在使用 SMTP 这个协议。SMTP 的全称为 Simple Mail Transfer Protocol,即「简单邮件传输协议」。正如它的名字锁暗示的,SMTP 实际上是一个非常简单(甚至简陋)的传输协议,本身并没有很好的安全措施。根据 SMTP 的规则,发件人的邮箱地址是可以由发信方任意声明的。在 SMTP 协议制定的时候也许还好,但在垃圾和诈骗邮件横行的今天,这显然是极不安全的。

SPF 出现的目的,就是为了防止随意伪造发件人。

SPF 记录的原理

SPF 记录实际上是服务器的一个 DNS 记录,原理其实很简单:

假设邮件服务器收到了一封邮件,来自主机的 IP 是173.194.72.103,并且声称发件人为This email address is being protected from spambots. You need JavaScript enabled to view it.。为了确认发件人不是伪造的,邮件服务器会去查询example.com的 SPF 记录。如果该域的 SPF 记录设置允许 IP 为173.194.72.103的主机发送邮件,则服务器就认为这封邮件是合法的;如果不允许,则通常会退信,或将其标记为垃圾/仿冒邮件。

因为不怀好心的人虽然可以「声称」他的邮件来自example.com,但是他却无权操作example.com的 DNS 记录;同时他也无法伪造自己的 IP 地址。因此 SPF 是很有效的,当前基本上所有的邮件服务提供商(例如 Gmail、QQ 邮箱等)都会验证它。

SPF 记录的语法

一条 SPF 记录定义了一个或者多个 mechanism,而 mechanism 则定义了哪些 IP 是允许的,哪些 IP 是拒绝的。

这些 mechanism 包括以下几类:

all | ip4 | ip6 | a | mx | ptr | exists | include

每个 mechanism 可以有四种前缀:

"+"  Pass(通过)
"-"  Fail(拒绝)
"~"  Soft Fail(软拒绝)
"?"  Neutral(中立)

测试时,将从前往后依次测试每个 mechanism。如果一个 mechanism 包含了要查询的 IP 地址(称为命中),则测试结果由相应 mechanism 的前缀决定。默认的前缀为+。如果测试完所有的 mechanisms 也没有命中,则结果为 Neutral。

除了以上四种情况,还有 None(无结果)、PermError(永久错误)和 TempError(临时错误)三种其他情况。对于这些情况的解释和服务器通常的处理办法如下:

结果 含义 服务器处理办法
Pass 发件 IP 是合法的 接受来信
Fail 发件 IP 是非法的 退信
Soft Fail 发件 IP 非法,但是不采取强硬措施 接受来信,但是做标记
Neutral SPF 记录中没有关于发件 IP 是否合法的信息 接受来信
None 服务器没有设定 SPF 记录 接受来信
PermError 发生了严重错误(例如 SPF 记录语法错误) 没有规定
TempError 发生了临时错误(例如 DNS 查询失败) 接受或拒绝

注意,上面所说的「服务器处理办法」仅仅是 SPF 标准做出的建议,并非所有的邮件服务器都严格遵循这套规定。

Mechanisms

下面介绍上面提到的 mechanism:

all

表示所有 IP,肯定会命中。因此通常把它放在 SPF 记录的结尾,表示处理剩下的所有情况。例如:

"v=spf1 -all" 拒绝所有(表示这个域名不会发出邮件)
"v=spf1 +all" 接受所有(域名所有者认为 SPF 是没有用的,或者根本不在乎它)

ip4

格式为ip4:<ip4-address>或者ip4:<ip4-network>/<prefix-length>,指定一个 IPv4 地址或者地址段。如果prefix-length没有给出,则默认为/32。例如:

"v=spf1 ip4:192.168.0.1/16 -all"
只允许在 192.168.0.1 ~ 192.168.255.255 范围内的 IP

ip6

格式和ip4的很类似,默认的prefix-length/128。例如:

"v=spf1 ip6:1080::8:800:200C:417A/96 -all"
只允许在 1080::8:800:0000:0000 ~ 1080::8:800:FFFF:FFFF 范围内的 IP

a 和 mx

这俩的格式是相同的,以a为例,格式为以下四种之一:

a
a/<prefix-length>
a:<domain>
a:<domain>/<prefix-length>

会命中相应域名的 a 记录(或 mx 记录)中包含的 IP 地址(或地址段)。如果没有提供域名,则使用当前域名。例如:

"v=spf1 mx -all"
允许当前域名的 mx 记录对应的 IP 地址。

"v=spf1 mx mx:deferrals.example.com -all"
允许当前域名和 deferrals.example.com 的 mx 记录对应的 IP 地址。

"v=spf1 a/24 -all"
类似地,这个用法则允许一个地址段。

例如,这是一个比较常见的 SPF 记录,它表示支持当前域名的 a 记录和 mx 记录,同时支持一个给定的 IP 地址;其他地址则拒绝:

v=spf1 a mx ip4:173.194.72.103 -all

include

格式为include:<domain>,表示引入<domain>域名下的 SPF 记录。注意,如果该域名下不存在 SPF 记录,则会导致一个PermError结果。例如:

"v=spf1 include:example.com -all" 即采用和 example.com 完全一样的 SPF 记录

exists

格式为exists:<domain>。将对<domain>执行一个 A 查询,如果有返回结果(无论结果是什么),都会看作命中。

ptr

格式为ptr或者ptr:<domain>。使用ptr机制会带来大量很大开销的 DNS 查询,所以连官方都不推荐使用它。

关于v=spf1

这是必须的,这个表示采用 SPF 1 版本,现在它的最新版本就是第 1 版。

Modifiers

SPF 记录中还可以包括两种可选的 modifier;一个 modifier 只能出现一次。

redirect

格式为redirect=<domain>

将用给定域名的 SPF 记录替换当前记录。

exp

格式为exp=<domain>,目的是如果邮件被拒绝,可以给出一个消息。而消息的具体内容会首先对<domain>执行 TXT 查询,然后执行宏扩展得到。

如何用 SPF 保护我的域名

如果你拥有自己的域名,并且用它发送邮件,那么你应该为它添加 SPF。通过域名服务商提供的「域名解析」、「DNS Editor」或者「DNS Zone Editor」等功能添加,并填写正确的 SPF 数据就可以了。

严格来说,SPF 数据应该创建为 SPF 记录。但是鉴于很多 DNS 服务商不支持 SPF 记录,甚至有的邮件服务器也不支持 SPF 记录,因此也可以创建为一条 TXT 记录。目前,你应该至少创建一条 TXT 记录。

因为本质上 SPF 的作用是为一个域名指定合法的发件 IP,所以你需要知道自己使用的邮件服务器的发件 IP 是什么。如果你使用第三方的域名邮箱服务(比如腾讯的域名邮箱),那么他们应该有相应的文档告诉你该怎么填写。如果你用虚拟主机,则主机提供商也应该会告诉你。

生效时间

SPF 记录本质上是一个 DNS 记录,所以并不是修改之后立即生效的——通常需要几个小时的时间。

一些工具

虽然我不能帮你决定 SPF 该填什么,但是这里有一些非常好用的工具可以帮助你,点击它们在新窗口打开:

  • Open SPF:官方网站,有很多资料,值得一看。
  • RFC 4408:SPFv1 的规范全文。
  • SPF Recored Testing Tools:帮助你验证域名是否存在 SPF 记录、记录的语法是否正确,以及输入 IP 和 host 来测试是不是真正管用。
  • SPF: Why?:为什么我发的邮件被拒绝了?
  • Beveridge Hosting DNS Lookup:图形界面的dig,也可以显示查询到的 SPF 信息。
  • Beveridge SPF Test:另一个根据 IP 和 host 验证 SPF 是否通过的工具。
  • Gmail:如果你有 Gmail 的话,可以给自己的 Gmail 邮箱发一封邮件,然后用 Gmail 独有的 Show Original 功能查看 Gmail 服务器的 SPF 判断结果。

About Us

Since 1996, our company has been focusing on domain name registration, web hosting, server hosting, website construction, e-commerce and other Internet services, and constantly practicing the concept of "providing enterprise-level solutions and providing personalized service support". As a Dell Authorized Solution Provider, we also provide hardware product solutions associated with the company's services.
 

Contact Us

Address: No. 2, Jingwu Road, Zhengzhou City, Henan Province

Phone: 0086-371-63520088 

QQ:76257322

Website: 800188.com

E-mail: This email address is being protected from spambots. You need JavaScript enabled to view it.