11 #include <sys/types.h>
19 #include "sysdep_decls.h"
20 #include "citserver.h"
23 #include "dynloader.h"
30 #include "internet_addressing.h"
33 #include "clientsocket.h"
36 struct citsmtp { /* Information about the current session */
39 struct usersupp vrfy_buffer;
43 int number_of_recipients;
47 enum { /* Command states for login authentication */
53 enum { /* Delivery modes */
58 #define SMTP ((struct citsmtp *)CtdlGetUserData(SYM_SMTP))
59 #define SMTP_RECP ((char *)CtdlGetUserData(SYM_SMTP_RECP))
66 /*****************************************************************************/
67 /* SMTP SERVER (INBOUND) STUFF */
68 /*****************************************************************************/
74 * Here's where our SMTP session begins its happy day.
76 void smtp_greeting(void) {
78 strcpy(CC->cs_clientname, "SMTP session");
80 CC->cs_flags |= CS_STEALTH;
81 CtdlAllocUserData(SYM_SMTP, sizeof(struct citsmtp));
82 CtdlAllocUserData(SYM_SMTP_RECP, 256);
83 sprintf(SMTP_RECP, "%s", "");
85 cprintf("220 Welcome to the Citadel/UX ESMTP server at %s\r\n",
91 * Implement HELO and EHLO commands.
93 void smtp_hello(char *argbuf, int is_esmtp) {
95 safestrncpy(SMTP->helo_node, argbuf, sizeof SMTP->helo_node);
98 cprintf("250 Greetings and joyous salutations.\r\n");
101 cprintf("250-Greetings and joyous salutations.\r\n");
102 cprintf("250-HELP\r\n");
103 cprintf("250-SIZE %ld\r\n", config.c_maxmsglen);
104 cprintf("250 AUTH=LOGIN\r\n");
110 * Implement HELP command.
112 void smtp_help(void) {
113 cprintf("214-Here's the frequency, Kenneth:\r\n");
114 cprintf("214- DATA\r\n");
115 cprintf("214- EHLO\r\n");
116 cprintf("214- EXPN\r\n");
117 cprintf("214- HELO\r\n");
118 cprintf("214- HELP\r\n");
119 cprintf("214- MAIL\r\n");
120 cprintf("214- NOOP\r\n");
121 cprintf("214- QUIT\r\n");
122 cprintf("214- RCPT\r\n");
123 cprintf("214- RSET\r\n");
124 cprintf("214- VRFY\r\n");
125 cprintf("214 I could tell you more, but then I'd have to kill you.\r\n");
132 void smtp_get_user(char *argbuf) {
136 decode_base64(username, argbuf);
137 lprintf(9, "Trying <%s>\n", username);
138 if (CtdlLoginExistingUser(username) == login_ok) {
139 encode_base64(buf, "Password:");
140 cprintf("334 %s\r\n", buf);
141 SMTP->command_state = smtp_password;
144 cprintf("500 No such user.\r\n");
145 SMTP->command_state = smtp_command;
153 void smtp_get_pass(char *argbuf) {
156 decode_base64(password, argbuf);
157 lprintf(9, "Trying <%s>\n", password);
158 if (CtdlTryPassword(password) == pass_ok) {
159 cprintf("235 Authentication successful.\r\n");
160 lprintf(9, "SMTP authenticated login successful\n");
161 CC->internal_pgm = 0;
162 CC->cs_flags &= ~CS_STEALTH;
165 cprintf("500 Authentication failed.\r\n");
167 SMTP->command_state = smtp_command;
174 void smtp_auth(char *argbuf) {
177 if (strncasecmp(argbuf, "login", 5) ) {
178 cprintf("550 We only support LOGIN authentication.\r\n");
182 if (strlen(argbuf) >= 7) {
183 smtp_get_user(&argbuf[6]);
187 encode_base64(buf, "Username:");
188 cprintf("334 %s\r\n", buf);
189 SMTP->command_state = smtp_user;
195 * Back end for smtp_vrfy() command
197 void smtp_vrfy_backend(struct usersupp *us, void *data) {
199 if (!fuzzy_match(us, SMTP->vrfy_match)) {
201 memcpy(&SMTP->vrfy_buffer, us, sizeof(struct usersupp));
207 * Implements the VRFY (verify user name) command.
208 * Performs fuzzy match on full user names.
210 void smtp_vrfy(char *argbuf) {
211 SMTP->vrfy_count = 0;
212 strcpy(SMTP->vrfy_match, argbuf);
213 ForEachUser(smtp_vrfy_backend, NULL);
215 if (SMTP->vrfy_count < 1) {
216 cprintf("550 String does not match anything.\r\n");
218 else if (SMTP->vrfy_count == 1) {
219 cprintf("250 %s <cit%ld@%s>\r\n",
220 SMTP->vrfy_buffer.fullname,
221 SMTP->vrfy_buffer.usernum,
224 else if (SMTP->vrfy_count > 1) {
225 cprintf("553 Request ambiguous: %d users matched.\r\n",
234 * Back end for smtp_expn() command
236 void smtp_expn_backend(struct usersupp *us, void *data) {
238 if (!fuzzy_match(us, SMTP->vrfy_match)) {
240 if (SMTP->vrfy_count >= 1) {
241 cprintf("250-%s <cit%ld@%s>\r\n",
242 SMTP->vrfy_buffer.fullname,
243 SMTP->vrfy_buffer.usernum,
248 memcpy(&SMTP->vrfy_buffer, us, sizeof(struct usersupp));
254 * Implements the EXPN (expand user name) command.
255 * Performs fuzzy match on full user names.
257 void smtp_expn(char *argbuf) {
258 SMTP->vrfy_count = 0;
259 strcpy(SMTP->vrfy_match, argbuf);
260 ForEachUser(smtp_expn_backend, NULL);
262 if (SMTP->vrfy_count < 1) {
263 cprintf("550 String does not match anything.\r\n");
265 else if (SMTP->vrfy_count >= 1) {
266 cprintf("250 %s <cit%ld@%s>\r\n",
267 SMTP->vrfy_buffer.fullname,
268 SMTP->vrfy_buffer.usernum,
275 * Implements the RSET (reset state) command.
276 * Currently this just zeroes out the state buffer. If pointers to data
277 * allocated with mallok() are ever placed in the state buffer, we have to
278 * be sure to phree() them first!
280 void smtp_rset(void) {
281 memset(SMTP, 0, sizeof(struct citsmtp));
282 if (CC->logged_in) logout(CC);
283 cprintf("250 Zap!\r\n");
289 * Implements the "MAIL From:" command
291 void smtp_mail(char *argbuf) {
296 if (strlen(SMTP->from) != 0) {
297 cprintf("503 Only one sender permitted\r\n");
301 if (strncasecmp(argbuf, "From:", 5)) {
302 cprintf("501 Syntax error\r\n");
306 strcpy(SMTP->from, &argbuf[5]);
309 if (strlen(SMTP->from) == 0) {
310 cprintf("501 Empty sender name is not permitted\r\n");
315 /* If this SMTP connection is from a logged-in user, make sure that
316 * the user only sends email from his/her own address.
319 cvt = convert_internet_address(user, node, SMTP->from);
320 lprintf(9, "cvt=%d, citaddr=<%s@%s>\n", cvt, user, node);
321 if ( (cvt != 0) || (strcasecmp(user, CC->usersupp.fullname))) {
322 cprintf("550 <%s> is not your address.\r\n", SMTP->from);
323 strcpy(SMTP->from, "");
328 /* Otherwise, make sure outsiders aren't trying to forge mail from
332 cvt = convert_internet_address(user, node, SMTP->from);
333 lprintf(9, "cvt=%d, citaddr=<%s@%s>\n", cvt, user, node);
334 if (CtdlHostAlias(node) == hostalias_localhost) {
335 cprintf("550 You must log in to send mail from %s\r\n",
337 strcpy(SMTP->from, "");
342 cprintf("250 Sender ok. Groovy.\r\n");
348 * Implements the "RCPT To:" command
350 void smtp_rcpt(char *argbuf) {
355 int is_spam = 0; /* FIX implement anti-spamming */
357 if (strlen(SMTP->from) == 0) {
358 cprintf("503 MAIL first, then RCPT. Duh.\r\n");
362 if (strncasecmp(argbuf, "To:", 3)) {
363 cprintf("501 Syntax error\r\n");
367 strcpy(recp, &argbuf[3]);
371 cvt = convert_internet_address(user, node, recp);
372 sprintf(recp, "%s@%s", user, node);
376 case rfc822_address_locally_validated:
377 cprintf("250 %s is a valid recipient.\r\n", user);
378 ++SMTP->number_of_recipients;
379 CtdlReallocUserData(SYM_SMTP_RECP,
380 strlen(SMTP_RECP) + 1024 );
381 strcat(SMTP_RECP, "local|");
382 strcat(SMTP_RECP, user);
383 strcat(SMTP_RECP, "|0\n");
386 case rfc822_room_delivery:
387 cprintf("250 Delivering to room '%s'\r\n", user);
388 ++SMTP->number_of_recipients;
389 CtdlReallocUserData(SYM_SMTP_RECP,
390 strlen(SMTP_RECP) + 1024 );
391 strcat(SMTP_RECP, "room|");
392 strcat(SMTP_RECP, user);
393 strcat(SMTP_RECP, "|0|\n");
396 case rfc822_no_such_user:
397 cprintf("550 %s: no such user\r\n", recp);
400 case rfc822_address_invalid:
402 cprintf("551 Away with thee, spammer!\r\n");
405 cprintf("250 Remote recipient %s ok\r\n", recp);
406 ++SMTP->number_of_recipients;
407 CtdlReallocUserData(SYM_SMTP_RECP,
408 strlen(SMTP_RECP) + 1024 );
409 strcat(SMTP_RECP, "remote|");
410 strcat(SMTP_RECP, recp);
411 strcat(SMTP_RECP, "|0|\n");
417 cprintf("599 Unknown error\r\n");
425 * Back end for smtp_data() ... this does the actual delivery of the message
426 * Returns 0 on success, nonzero on failure
428 int smtp_message_delivery(struct CtdlMessage *msg) {
435 int successful_saves = 0; /* number of successful local saves */
436 int failed_saves = 0; /* number of failed deliveries */
437 int remote_spools = 0; /* number of copies to send out */
440 struct usersupp userbuf;
441 char *instr; /* Remote delivery instructions */
442 struct CtdlMessage *imsg;
444 lprintf(9, "smtp_message_delivery() called\n");
446 /* Fill in 'from' fields with envelope information if missing */
447 process_rfc822_addr(SMTP->from, user, node, name);
448 if (msg->cm_fields['A']==NULL) msg->cm_fields['A'] = strdoop(user);
449 if (msg->cm_fields['N']==NULL) msg->cm_fields['N'] = strdoop(node);
450 if (msg->cm_fields['H']==NULL) msg->cm_fields['H'] = strdoop(name);
452 /* Save the message in the queue */
453 msgid = CtdlSaveMsg(msg,
460 instr = mallok(1024);
461 sprintf(instr, "Content-type: %s\n\nmsgid|%ld\nsubmitted|%ld\n",
462 SPOOLMIME, msgid, time(NULL) );
464 for (i=0; i<SMTP->number_of_recipients; ++i) {
465 extract_token(buf, SMTP_RECP, i, '\n');
466 extract(dtype, buf, 0);
468 /* Stuff local mailboxes */
469 if (!strcasecmp(dtype, "local")) {
470 extract(user, buf, 1);
471 if (getuser(&userbuf, user) == 0) {
472 MailboxName(room, &userbuf, MAILROOM);
473 CtdlSaveMsgPointerInRoom(room, msgid, 0);
481 /* Delivery to local non-mailbox rooms */
482 if (!strcasecmp(dtype, "room")) {
483 extract(room, buf, 1);
484 CtdlSaveMsgPointerInRoom(room, msgid, 0);
488 /* Remote delivery */
489 if (!strcasecmp(dtype, "remote")) {
490 extract(user, buf, 1);
491 instr = reallok(instr, strlen(instr) + 1024);
492 sprintf(&instr[strlen(instr)],
500 /* If there are remote spools to be done, save the instructions */
501 if (remote_spools > 0) {
502 imsg = mallok(sizeof(struct CtdlMessage));
503 memset(imsg, 0, sizeof(struct CtdlMessage));
504 imsg->cm_magic = CTDLMESSAGE_MAGIC;
505 imsg->cm_anon_type = MES_NORMAL;
506 imsg->cm_format_type = FMT_RFC822;
507 imsg->cm_fields['M'] = instr;
508 CtdlSaveMsg(imsg, "", SMTP_SPOOLOUT_ROOM, MES_LOCAL, 1);
509 CtdlFreeMessage(imsg);
512 /* If there are no remote spools, delete the message */
514 phree(instr); /* only needed here, because CtdlSaveMsg()
515 * would free this buffer otherwise */
516 CtdlDeleteMessages(SMTP_SPOOLOUT_ROOM, msgid, NULL);
519 return(failed_saves);
525 * Implements the DATA command
527 void smtp_data(void) {
529 struct CtdlMessage *msg;
533 if (strlen(SMTP->from) == 0) {
534 cprintf("503 Need MAIL command first.\r\n");
538 if (SMTP->number_of_recipients < 1) {
539 cprintf("503 Need RCPT command first.\r\n");
543 cprintf("354 Transmit message now; terminate with '.' by itself\r\n");
545 generate_rfc822_datestamp(nowstamp, time(NULL));
548 if (body != NULL) sprintf(body,
549 "Received: from %s\n"
556 body = CtdlReadMessageBody(".", config.c_maxmsglen, body);
558 cprintf("550 Unable to save message text: internal error.\r\n");
562 lprintf(9, "Converting message...\n");
563 msg = convert_internet_message(body);
565 /* If the user is locally authenticated, FORCE the From: header to
566 * show up as the real sender
569 if (msg->cm_fields['A'] != NULL) phree(msg->cm_fields['A']);
570 if (msg->cm_fields['N'] != NULL) phree(msg->cm_fields['N']);
571 if (msg->cm_fields['H'] != NULL) phree(msg->cm_fields['H']);
572 msg->cm_fields['A'] = strdoop(CC->usersupp.fullname);
573 msg->cm_fields['N'] = strdoop(config.c_nodename);
574 msg->cm_fields['H'] = strdoop(config.c_humannode);
577 retval = smtp_message_delivery(msg);
578 CtdlFreeMessage(msg);
581 cprintf("250 Message accepted for delivery.\r\n");
584 cprintf("550 Internal delivery errors: %d\r\n", retval);
592 * Main command loop for SMTP sessions.
594 void smtp_command_loop(void) {
598 memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
599 if (client_gets(cmdbuf) < 1) {
600 lprintf(3, "SMTP socket is broken. Ending session.\n");
604 lprintf(5, "citserver[%3d]: %s\n", CC->cs_pid, cmdbuf);
605 while (strlen(cmdbuf) < 5) strcat(cmdbuf, " ");
607 if (SMTP->command_state == smtp_user) {
608 smtp_get_user(cmdbuf);
611 else if (SMTP->command_state == smtp_password) {
612 smtp_get_pass(cmdbuf);
615 else if (!strncasecmp(cmdbuf, "AUTH", 4)) {
616 smtp_auth(&cmdbuf[5]);
619 else if (!strncasecmp(cmdbuf, "DATA", 4)) {
623 else if (!strncasecmp(cmdbuf, "EHLO", 4)) {
624 smtp_hello(&cmdbuf[5], 1);
627 else if (!strncasecmp(cmdbuf, "EXPN", 4)) {
628 smtp_expn(&cmdbuf[5]);
631 else if (!strncasecmp(cmdbuf, "HELO", 4)) {
632 smtp_hello(&cmdbuf[5], 0);
635 else if (!strncasecmp(cmdbuf, "HELP", 4)) {
639 else if (!strncasecmp(cmdbuf, "MAIL", 4)) {
640 smtp_mail(&cmdbuf[5]);
643 else if (!strncasecmp(cmdbuf, "NOOP", 4)) {
644 cprintf("250 This command successfully did nothing.\r\n");
647 else if (!strncasecmp(cmdbuf, "QUIT", 4)) {
648 cprintf("221 Goodbye...\r\n");
653 else if (!strncasecmp(cmdbuf, "RCPT", 4)) {
654 smtp_rcpt(&cmdbuf[5]);
657 else if (!strncasecmp(cmdbuf, "RSET", 4)) {
661 else if (!strncasecmp(cmdbuf, "VRFY", 4)) {
662 smtp_vrfy(&cmdbuf[5]);
666 cprintf("502 I'm sorry Dave, I'm afraid I can't do that.\r\n");
674 /*****************************************************************************/
675 /* SMTP CLIENT (OUTBOUND PROCESSING) STUFF */
676 /*****************************************************************************/
683 * Called by smtp_do_procmsg() to attempt delivery to one SMTP host
686 void smtp_try(char *key, char *addr, int *status, char *dsn, long msgnum)
693 char user[256], node[256], name[256];
695 /* Parse out the host portion of the recipient address */
696 process_rfc822_addr(addr, user, node, name);
697 lprintf(9, "Attempting SMTP delivery to <%s> @ <%s> (%s)\n",
700 num_mxhosts = getmx(mxhosts, node);
701 lprintf(9, "Number of MX hosts for <%s> is %d\n", node, num_mxhosts);
702 if (num_mxhosts < 1) {
704 sprintf(dsn, "No MX hosts found for <%s>", node);
708 for (mx=0; mx<num_mxhosts; ++mx) {
709 extract(buf, mxhosts, mx);
710 lprintf(9, "Trying <%s>\n", buf);
711 sock = sock_connect(buf, "25", "tcp");
712 sprintf(dsn, "Could not connect: %s", strerror(errno));
713 if (sock >= 0) lprintf(9, "Connected!\n");
714 if (sock < 0) sprintf(dsn, "%s", strerror(errno));
715 if (sock >= 0) break;
719 *status = 4; /* dsn is already filled in */
723 /* Process the SMTP greeting from the server */
724 if (sock_gets(sock, buf) < 0) {
726 strcpy(dsn, "Connection broken during SMTP conversation");
730 lprintf(9, "%s\n", buf);
734 strcpy(dsn, &buf[4]);
740 strcpy(dsn, &buf[4]);
746 /* At this point we know we are talking to a real SMTP server */
748 /* Do a HELO command */
749 sprintf(buf, "HELO %s", config.c_fqdn);
750 sock_puts(sock, buf);
751 if (sock_gets(sock, buf) < 0) {
753 strcpy(dsn, "Connection broken during SMTP conversation");
757 lprintf(9, "%s\n", buf);
761 strcpy(dsn, &buf[4]);
767 strcpy(dsn, &buf[4]);
774 /* HELO succeeded, now try the MAIL From: command */
775 sprintf(buf, "MAIL From: FIX@uncnsrd.mt-kisco.ny.us"); /* FIX */
776 sock_puts(sock, buf);
777 if (sock_gets(sock, buf) < 0) {
779 strcpy(dsn, "Connection broken during SMTP conversation");
783 lprintf(9, "%s\n", buf);
787 strcpy(dsn, &buf[4]);
793 strcpy(dsn, &buf[4]);
800 /* MAIL succeeded, now try the RCPT To: command */
801 sprintf(buf, "RCPT To: %s", addr);
802 sock_puts(sock, buf);
803 if (sock_gets(sock, buf) < 0) {
805 strcpy(dsn, "Connection broken during SMTP conversation");
809 lprintf(9, "%s\n", buf);
813 strcpy(dsn, &buf[4]);
819 strcpy(dsn, &buf[4]);
826 /* RCPT succeeded, now try the DATA command */
827 sock_puts(sock, "DATA");
828 if (sock_gets(sock, buf) < 0) {
830 strcpy(dsn, "Connection broken during SMTP conversation");
834 lprintf(9, "%s\n", buf);
838 strcpy(dsn, &buf[4]);
844 strcpy(dsn, &buf[4]);
850 /* If we reach this point, the server is expecting data */
851 CtdlOutputMsg(msgnum, MT_RFC822, 0, 0, NULL, sock, 1);
852 sock_puts(sock, ".");
853 if (sock_gets(sock, buf) < 0) {
855 strcpy(dsn, "Connection broken during SMTP conversation");
859 lprintf(9, "%s\n", buf);
863 strcpy(dsn, &buf[4]);
869 strcpy(dsn, &buf[4]);
876 strcpy(dsn, &buf[4]);
879 sock_puts(sock, "QUIT");
880 sock_gets(sock, buf);
881 lprintf(9, "%s\n", buf);
891 * Called by smtp_do_queue() to handle an individual message.
893 void smtp_do_procmsg(long msgnum) {
894 struct CtdlMessage *msg;
896 char *results = NULL;
904 long text_msgid = (-1);
906 msg = CtdlFetchMessage(msgnum);
908 lprintf(3, "SMTP: tried %ld but no such message!\n", msgnum);
912 instr = strdoop(msg->cm_fields['M']);
913 CtdlFreeMessage(msg);
915 /* Strip out the headers amd any other non-instruction line */
916 lines = num_tokens(instr, '\n');
917 for (i=0; i<lines; ++i) {
918 extract_token(buf, instr, i, '\n');
919 if (num_tokens(buf, '|') < 2) {
920 lprintf(9, "removing <%s>\n", buf);
921 remove_token(instr, i, '\n');
927 /* Learn the message ID */
928 lines = num_tokens(instr, '\n');
929 for (i=0; i<lines; ++i) {
930 extract_token(buf, instr, i, '\n');
931 extract(key, buf, 0);
932 if (!strcasecmp(key, "msgid")) {
933 text_msgid = extract_long(buf, 1);
937 if (text_msgid < 0L) {
938 lprintf(3, "SMTP: no 'msgid' directive found!\n");
943 /* Plow through the instructions looking for 'remote' directives and
944 * a status of 0 (no delivery yet attempted) or 3 (transient errors
945 * were experienced and it's time to try again)
947 lines = num_tokens(instr, '\n');
948 for (i=0; i<lines; ++i) {
949 extract_token(buf, instr, i, '\n');
950 extract(key, buf, 0);
951 extract(addr, buf, 1);
952 status = extract_int(buf, 2);
953 extract(dsn, buf, 3);
954 if ( (!strcasecmp(key, "remote"))
955 && ((status==0)||(status==3)) ) {
956 remove_token(instr, i, '\n');
959 lprintf(9, "SMTP: Trying <%s>\n", addr);
960 smtp_try(key, addr, &status, dsn, text_msgid);
962 if (results == NULL) {
963 results = mallok(1024);
964 memset(results, 0, 1024);
967 results = reallok(results,
968 strlen(results) + 1024);
970 sprintf(&results[strlen(results)],
972 key, addr, status, dsn);
977 if (results != NULL) {
978 instr = reallok(instr, strlen(instr) + strlen(results) + 2);
979 strcat(instr, results);
983 /* Delete the instructions and replace with the updated ones */
984 CtdlDeleteMessages(SMTP_SPOOLOUT_ROOM, msgnum, NULL);
985 msg = mallok(sizeof(struct CtdlMessage));
986 memset(msg, 0, sizeof(struct CtdlMessage));
987 msg->cm_magic = CTDLMESSAGE_MAGIC;
988 msg->cm_anon_type = MES_NORMAL;
989 msg->cm_format_type = FMT_RFC822;
990 msg->cm_fields['M'] = malloc(strlen(instr)+256);
991 sprintf(msg->cm_fields['M'],
992 "Content-type: %s\n\n%s\n", SPOOLMIME, instr);
994 CtdlSaveMsg(msg, "", SMTP_SPOOLOUT_ROOM, MES_LOCAL, 1);
995 CtdlFreeMessage(msg);
1003 * Run through the queue sending out messages.
1005 void smtp_do_queue(void) {
1006 lprintf(5, "SMTP: processing outbound queue\n");
1008 if (getroom(&CC->quickroom, SMTP_SPOOLOUT_ROOM) != 0) {
1009 lprintf(3, "Cannot find room <%s>\n", SMTP_SPOOLOUT_ROOM);
1012 CtdlForEachMessage(MSGS_ALL, 0L, SPOOLMIME, NULL, smtp_do_procmsg);
1014 lprintf(5, "SMTP: queue run completed\n");
1018 /**** FIX temporary hack to run the queue *****/
1019 void cmd_qqqq(char *argbuf) {
1021 cprintf("%d ok\n", OK);
1026 /*****************************************************************************/
1027 /* MODULE INITIALIZATION STUFF */
1028 /*****************************************************************************/
1031 char *Dynamic_Module_Init(void)
1033 SYM_SMTP = CtdlGetDynamicSymbol();
1034 SYM_SMTP_RECP = CtdlGetDynamicSymbol();
1035 CtdlRegisterServiceHook(SMTP_PORT,
1039 /**** FIX ... temporary hack to run the queue ******/
1040 CtdlRegisterProtoHook(cmd_qqqq, "QQQQ", "run the queue");
1042 create_room(SMTP_SPOOLOUT_ROOM, 3, "", 0);