Check if the SMTP address is blacklisted by the detection site

Source: Internet
Author: User
Tags mailmessage

通常,我们可能因为某些用户发送了一些非常规邮件,邮件出口地址被一些权威网站列入黑名单,导致大量业务邮件无法正常发送。 这时候,我们可以通过powershell写一些关于IP地址检测的脚本,并列入计划任务,最大程度上降低邮件出口地址被列入黑名单产生的业务影响,脚本内容如下:

#获取页面信息
$web = (invoke-webrequest "https://www.talosintelligence.com/reputation_center/lookup?search=xxx.xxx.xxx.xxx"). Content

#自定义邮件属性 & Content
$msg 1= "xxx.xxx.xxx.xxx blacklist, please check!"
$msg 2= "MailAddress isn't included in the blacklist!"
$SMTP = "SMTP Server" br/> $from = "[email protected]"
[Email protected] "br/> $cc ="[email protected]"

$body 1= "SMTP address is ok!"

#判断IP地址是否被Black
if ($web-match ' <span class= "blacklisted" >Listed</span> ')
{send-mailmessage-subject $msg 1-smtpserver $smtp-from $from-to $to-cc $cc-body $body
}

Else
{send-mailmessage-subject $msg 2-smtpserver $smtp-from $from-to $to-cc $cc-body "$body 1"
}

Check if the SMTP address is blacklisted by the detection site

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.