The file "/var/qmail/control/badmailfrom" is used by qmail-smtpd to reject certain email addresses or domains in the envelope. lines in this file may look like " ", or "" to block the entire domain.

if you create this file, make sure to IMMEDIATELY do "chmod 644" on it so that qmail-smtpd can read it. creating or changing this file does not necessitate restarting qmail or the smtp service, but if any messages try to come in during the time between when you create the file and when you set the permissions on it, those message will be refused with the error message "unable to read controls".

however, this only checks the ENVELOPE sender- whatever the sending machine puts in the MAIL FROM: command. it doesn't look at the "From:" header inside the message. spammers will often use different email addresses for their envelope senders and their "From:" headers- but there are times when legitimate users do it as well, which means this is not a reliable flag for spam.

To check based on header values, you may want to look at writing some custom spamassassin rules so that mail with "From:" headers from these domains will be considered spam.