欢迎光临
我们一直在努力

检查SMTP地址是否被检测网站列入黑名单

            通常,我们可能因为某些用户发送了一些非常规邮件,邮件出口地址被一些权威网站列入黑名单,导致大量业务邮件无法正常发送。

            这时候,我们可以通过powershell写一些关于IP地址检测的脚本,并列入计划任务,最大程度上降低邮件出口地址被列入黑名单产生的业务影响,脚本内容如下:

#获取页面信息
$web=(Invoke-WebRequest "https://www.talosintelligence.com/reputation_center/lookup?search=xxx.xxx.xxx.xxx”).content

#自定义邮件属性&内容
$msg1="xxx.xxx.xxx.xxx blacklist, Please check!"
$msg2="Mailaddress is not included in the blacklist!"
$smtp="smtp server"$from=”xxx@contoso.com”
br/>$from=”xxx@contoso.com”<br/$to="xxx@contoso.com"$cc="xxx@contoso.com"
br/>$cc=”xxx@contoso.com”<br/$body="Smtp address in the blacklist,Please access http://www.spamhaus.org Remove!"
$body1="Smtp address is OK!"

#判断IP地址是否被Black
if ($web -match ‘<span class="blacklisted">Listed</span>’ )
{ Send-MailMessage -Subject $msg1 -SmtpServer $smtp -From $from -to $to -cc $cc -Body $body
}

else
{ Send-MailMessage -Subject $msg2 -SmtpServer $smtp -From $from -to $to -cc $cc -Body "$body1"
}

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。