strace of a smtpd/cleanup conversation: connect(10, {sa_family=AF_UNIX, path="public/cleanup"}, 110) = 0 select(11, [10], NULL, [10], {3600, 0}) = 1 (in [10], left {3599, 960000}) read(10, "queue_id\0CB60A405C\0\0", 4096) = 20 cleanup first sends a queue id write(10, "flags\0002\0\0T\n1057620721S\nhjp@hjp.a"..., 216) = 216 This really consists of two parts: flags\0002\0\0 is sent in the attr0 protocol described in util/attr_scan0.c The flags are described in global/cleanup_user.h: 2 is "Enable content filter", 1 is "Bounce bad messages". We don't need 1 (we bounce the message ourselves), I'm not sure about 2. Starting at "T" is the protocol described on rec_type.h write(10, "N\rSubject: testN\0X\0E\0", 21) = 21 here is the mail itself. read(10, "status\0000\0reason\0\0\0", 4096) = 18 and cleanup responds with status 0 (ok). The cleanup states are also described in cleanup_user.h. We need to translate them into proper SMTP relies(see smtpd/smtpd.c:data_cmd another one (this time with longer strings: socket(PF_UNIX, SOCK_STREAM, 0) = 10 fcntl64(10, F_GETFL) = 0x2 (flags O_RDWR) fcntl64(10, F_SETFL, O_RDWR) = 0 connect(10, {sa_family=AF_UNIX, path="public/cleanup"}, 110) = 0 select(11, [10], NULL, [10], {3600, 0}) = 1 (in [10], left {3599, 970000}) read(10, "queue_id\0002491F405C\0\0", 4096) = 20 wierd. The id contains leading zeros, but smtpd doesn't print them. And the length is different (11 bytes instead of 9). write(10, "flags\0002\0\0T\n1057621710S\nhjp@hjp.atR\17hjp@yoyo.hjp.atM\0N0Received: from localhost (localhost [127.0.0.1])N0\tby yoyo.hjp.at (Postfix) with SMTP id 2491F405CN>\tfor ; Tue, 8 Jul 2003 01:48:30 +0200 (CEST)", 216) = 216 envelope and header write(10, "N\rSubject: testN\0X\0E\0", 21) = 21 the mail plus trailer read(10, "status\0000\0reason\0\0\0", 4096) = 18 and cleanup's response.