Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1057329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:51:04+00:00 2026-05-16T17:51:04+00:00

Short story I’ve got a PHP script filtering incoming mail using a .qmail file.

  • 0

Short story

I’ve got a PHP script filtering incoming mail using a .qmail file. The script works perfectly well and logs all activity but, as far as I know, the last .qmail line shouldn’t be executed when my script returns a dot-qmail exit code 99 that should stop processing further .qmail lines.

Long story:

I’m using a Parallels Plesk Panel version 9.3.0 under Linux 2.6.18-4-686.

My PHP CLI version is 5.2.0-8+etch16 (cli) (built: Nov 24 2009 11:14:47).

Not satisfied with Spamassassin, Dr. Web and zen.spamhaus.org and their results, I decided to create my own PHP script for filtering all incoming mail.

(An aside to some of you who might think “this guy is reinventing the wheel”: I know my customers personally and their specific needs so, after thousands of tests, this turned out to be the best option because it avoids black box models and lets me control the process in a comprehensive way, also freeing server resources and opening doors to other cool functionality).

However I’m having a hard time installing the script at the server.

qmailfilter is my script and you can see it at http://titanpad.com/1IFDj1jvB0

I edited an existing .qmail file in /var/qmail/mailnames/customerdomain.com/username/.qmail to be:

|/var/my/qmailfilter/qmailfilter
|/usr/bin/deliverquota ./Maildir

qmailfilter PHP script executes and logs perfectly when I send a message to this user account, returns the exit code (99 for discarding message and 0 for proceeding to next .qmail line delivering the message).

Turns out that it delivers the message irrespectively of the many exit codes I’ve already tried.

The script (see line 174) outputs a text exit code without any whitespace before or after. I tried exit($code), print $code, echo($code) and even file_put_contents("php://stdout", $code), and also exit(chr($code)).

dot-qmail codes are:

0 – Success (go to next .qmail line)

99 – Success and abort (do not execute next lines)

100 – permanent error (bounce)

111 – soft error (retry later)

Source: The Big Qmail Picture.

Other attempts/experiments:

  1. Removed the shebang line (#!/usr/bin/php) and changed the first .qmail line to |php -q /var/my/qmailfilter/qmailfilter

  2. Checked the last line of the script for whitespacing

  3. Read dot-qmail man file but nothing conclusive was found

  4. Joined .qmail lines:

    |/var/my/qmailfilter/qmailfilter |/usr/bin/deliverquota ./Maildir

In this case I got a message having only the proper return code without any header, subject or message body.

  1. Commented out (#) the second .qmail line, but stopped receiving any kind of messages.

  2. Edited /var/qmail/control/defaultdelivery to add a first line:

    |php /var/my/qmailfilter/qmailfilter
    |/usr/bin/deliverquota ./Maildir

and renamed user .qmail file to _qmail. Same results.

Should I deliver the message via PHP script and forget exit codes?

If so, is it enough to save the message to the user Maildir/new?

If so, is the message filename important?

Any idea will be appreciated. Thanks very much!

UPDATE: For those of you who need it, I published the final script at icebex.com slash qmailfilter

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T17:51:05+00:00Added an answer on May 16, 2026 at 5:51 pm

    I only took a quick look at the code, but it looked like you were using string values. exit('99') and exit(99) are not the same. Make sure you use integers and not strings.

    • exit(’99’) will print 99 and return 0.

    • exit(99) will return 99.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 531k
  • Answers 531k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I seem to have found a work around that fixed… May 16, 2026 at 11:46 pm
  • Editorial Team
    Editorial Team added an answer This can be done in SQL Server 2005 and above… May 16, 2026 at 11:46 pm
  • Editorial Team
    Editorial Team added an answer Here's a simple example: GeoCoordinateWatcher watcher; watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default)… May 16, 2026 at 11:46 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Short story. This site was created by a friend of mine, who did not
Short story, I'm implementing a graph and now I'm working on the Kruskal, I
Short story: I can't make precompiled headers work properly with gcc -c option. Long
Short story: I can't get an entity like '𠂉' to store in a MySQL
The short story is I have a SQL Server DB with varchar fields instead
The short story: I want to convert a list/dictionary into an anonymous object Basically
Cut a short story even shorter, Have a asp.net page with MaintainScrollPositionOnPostback=true in the
Possible Duplicate: Qt equivalent of PathAppend? Short story: does Qt 4 have an analog
Long story short: on Chrome and Safari only, values from a login form are
Long story short: >>> re.compile(r\w*).match(uFrançais) <_sre.SRE_Match object at 0x1004246b0> >>> re.compile(r^\w*$).match(uFrançais) >>> re.compile(r^\w*$).match(uFranais) <_sre.SRE_Match

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.