While checking the mailq on the BLU server yesterday I noticed over 300 messages queued up for a single user (from a listserv). postfix has a program, postsuper that can be used to delete email from the queue, but first the mail queue needs to be parsed. Simple solution in C: Use the popen(3) function: Here is a short code fragment: #include <stdio.h> #include <string.h> #include <errno.h> int main() { FILE *ipipe; char buf[256]; if ((ipipe = popen("mailq", "r")) == NULL) { fprintf(stderr, "Popen error:%s\n", strerror(errno)); exit(-1); while (fgets(buf, sizeof(buf), ipipe)) { /**** process the buffer **** The first line contains the queue id, subsequent **** lines contain email addresses and error messages **** each queue id is terminated by an empty line. ****/ } pclose(ipipe); return 0; } In my case, I put all the queue entries into a linked list and matched them to some keywords entered by the user then built another command for postsuper. You can do a similar thing with postsuper by calling it once with input from standard input: /* Code frag */ FILE *opipe; if ((opipe = popen("postsuper -d -", "w")) == NULL) { fprintf(stderr, "Popen error:%s\n", strerror(errno)); exit(-1); /* foreach queue id to be deleted */ printf("%s", ll->qid); /* End foreach */ pclose(opipe); -- Jerry Feldman <gaf@blu.org> Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9