Postfix automatically discards emails from certain domains

Source: Internet
Author: User

In the Spring Festival, the mail system sent a large number of emails, and the system also accumulated a large number of emails. Suddenly, it was found that the most accumulated emails were from yahoo.com.cn and yahoo.cn.

Later, I thought it was because yahoo Mail stopped its service. Because users had previously registered with yahoo Mail, they repeatedly sent emails to yahoo Mail after purchasing tickets, about emails will be accumulated in a day. simply discard emails from yahoo Mail to save trouble.


1. Modify the postfix configuration file and add the following lines:

Smtpd_sender_restrictions = check_recipient_access hash:/etc/postfix/drop_domain


2. Create a rule file:

Vim/etc/postfix/drop_domain

Add the following lines

Yahoo.com.cn DISCARD

Yahoo.cn DISCARD

This means that if you encounter an email from yahoo.com.cn and yahoo.cn, DISCARD the email directly)


3. database files for production rules

Postmap drop_domain


4. Reload the postfix configuration file:

Service postfix reload


The following information is displayed in the log:

Jan 7 01:55:58 dp58-04 postfix/smtpd [31146]: NOQUEUE: discard: RCPT from unknown [10.1.217.68]: <*** @ yahoo.com.cn>: Recipient address triggers DISCARD action; from = <××× @ ×××.com.cn> to = <××× @ yahoo.com.cn> proto = SMTP helo = <test>


POSTFIX directly discards the email

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.