LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Postfix - Reject Emails w/ No Subject? (https://www.linuxquestions.org/questions/linux-server-73/postfix-reject-emails-w-no-subject-837499/)

carlosinfl 10-11-2010 06:39 PM

Postfix - Reject Emails w/ No Subject?
 
I was wondering how mail administrators handle emails w/o any subject material? I don't know if this is an RFC guideline that requires email to have a subject but I find it extremely annoying when email doesn't have a subject. I don't know if that's just personal preference or if it's an actual guideline for mail to have 'subject' data. Do you guys reject mail if no 'subject' is present in the message?

Noway2 10-12-2010 04:23 AM

I personally do not reject mail based upon the subject, or lack there of. I agree that it is annoying. Whether or not it is a violation of any RFC, I don't know and even if it is, most mail programs would probably ignore the rule by default anyway. I also know that I myself have been guilty of sending emails without a subject on occasion, by accident rather than deliberately.

You mention Postfix in your subject title and there may be a header check rule that will reject messages based on the lack of a subject. You will need to look at the postfix documentation to verify; the list of available content checks is quite long.

Wayne Sallee 08-24-2018 11:34 AM

This is an old thread, but the answer of how to reject and e-mail with no subject in Postfix is not properly answered anywhere on the internet.

Now that I have finally figured out how to do it, here is the answer:



Code:

/etc/postfix/main.cf
Code:

header_checks = regexp:/etc/postfix/header-checks



Code:

cat > /etc/postfix/header-checks << "EOF"
# /^Subject:.*I[[:space:]]spam[[:space:]]you/ REJECT I don't want your spam.
/^subject:[[:space:]]*$/ REJECT No Subjecto! You seem to be Subjectless.
/^subject:[[:space:]]*Re:$/ REJECT No Subjecto! You seem to be Subjectless.

EOF
postmap /etc/postfix/header-checks

I like using filename format "header-checks" instead of the other popular format "header_checks". You choose the format you like.

Code:

# /^Subject:.*I[[:space:]]spam[[:space:]]you/ REJECT I don't want your spam.
This is just a freebee. :-) If you need to block a phrase that has a space in it, use the above space command instead of leaving a space, as a space will cause errors.

Code:

/^subject:[[:space:]]*$/ REJECT No Subjecto! You seem to be Subjectless.
This will reject mail that has the "Subject: " in the headers, ie blank subject.


Code:

/^subject:[[:space:]]*Re:$/ REJECT No Subjecto! You seem to be Subjectless.
This will reject another common spam e-mail where in the headers you have "Subject: Re:"


Wayne Sallee
Wayne@WayneSallee.com
http://www.WayneSallee.com


All times are GMT -5. The time now is 02:19 PM.