问题描述
例如,我有一个具有此ips的数组,并想用我的代码创建一个长的spf记录:
For example I have an array with this ips and want to create with my code an long spf record:
$array_ips = array();
$array_ips[] = "32.16.8.133";
$array_ips[] = "32.16.4.247";
$array_ips[] = "35.16.8.184";
$array_ips[] = "32.16.8.127";
$array_ips[] = "32.16.8.134";
$array_ips[] = "32.16.2.154";
$array_ips[] = "32.16.2.153";
$array_ips[] = "32.16.2.150";
$array_ips[] = "39.16.2.190";
$array_ips[] = "32.16.2.128";
$array_ips[] = "32.16.0.128";
$array_ips[] = "32.16.8.187";
$array_ips[] = "43.16.8.185";
$array_ips[] = "32.16.8.192";
$array_ips[] = "32.16.4.249";
$array_ips[] = "52.16.4.252";
$array_ips[] = "32.16.4.238";
$array_ips[] = "32.16.4.232";
$ips = implode(' ip4:', $array_ips);
echo "v=spf1 +a +mx".$ips." -all";
spf记录为:
v=spf1 +a +mx ip4:32.16.8.133 ip4:32.16.4.247 ip4:32.16.8.184 ip4:32.16.8.127 ip4:32.16.8.134 ip4:32.16.2.154 ip4:32.16.2.153 ip4:32.16.2.150 ip4:32.16.2.190 ip4:32.16.2.128 ip4:32.16.0.128 ip4:32.16.8.187 ip4:32.16.8.185 ip4:32.16.8.192 ip4:32.16.4.249 ip4:32.16.4.252 ip4:32.16.4.238 ip4:32.16.4.232 -all
字符:307
问题是,SPF只能是最大值。 255个字符长。无法在txt dns记录的plesk或cpanel中添加如此长的字符串。我听说,如果有可能这样做 v = spf1 .... first spf第二个字符串...
。
The Problem is, that an SPF only can be max. 255 characters long. No possibility to add such a long string in plesk or cpanel in txt dns record. I have heared that if could be possible to do it like this "v=spf1 .... first" "spf second string..."
.
但这真的有用吗?
如何在上面的示例中生成它?
But does it realy work?How to do it by generating it in my example above?
推荐答案
您可以将其分解为多个include。
You can break it up into multiple include's..
"v=spf1 mx a include:iprange1.example.com include:iprange2.example.com -all"
然后在每个包含DNS的目录下
Then under each include DNS you'll have
iprange1.example.com = "v=spf1 ip4:32.16.8.133 ... -all"
iprange2.example.com = "v=spf1 ip4:32.16.4.238 ... -all"
这将为您提供更多的空间,因为您可以包括8个include和您的mx以及一个
This will gave you a lot more room because you'll be able to include 8 includes along with your mx and a
然后每个include可以容纳16个ip4地址,这将为您提供大约128个IP地址,而您无法CIDR。
Then each include can hold 16 ip4 addresses that will get your around 128 IP addresses that your can't CIDR.
编辑-iprange1-> iprange2,位于第二个代码段的第二行
Edit - iprange1 --> iprange2 on line 2 of 2nd code snippet
这篇关于如何为许多IP创建SPF记录(SPF超过255个字符)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!