From: Art Cancro Date: Sun, 23 Jan 2000 05:22:42 +0000 (+0000) Subject: * Coded up some more of the SMTP-sender (still not done) X-Git-Tag: v7.86~7334 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=5dc36f6bbd05e378117d8a47fb759916d689376f * Coded up some more of the SMTP-sender (still not done) --- diff --git a/citadel/ChangeLog b/citadel/ChangeLog index cf3cc72a4..1d0925f80 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,7 @@ $Log$ +Revision 1.450 2000/01/23 05:22:41 ajc +* Coded up some more of the SMTP-sender (still not done) + Revision 1.449 2000/01/22 05:13:56 ajc * Added some more functionality to the string tokenizer @@ -1575,4 +1578,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/domain.c b/citadel/domain.c index 3efb74fef..df44d21dd 100644 --- a/citadel/domain.c +++ b/citadel/domain.c @@ -3,6 +3,7 @@ #include #include #include +#include "sysdep_decls.h" #include "domain.h" #define SMART_HOST "gatekeeper.wdcs.com" @@ -20,7 +21,6 @@ int getmx(char *mxbuf, char *dest) { char answer[1024]; int ret; - int i; /* If we're configured to send all mail to a smart-host, then our diff --git a/citadel/msgbase.c b/citadel/msgbase.c index f4513c6f7..bd118964f 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -1529,6 +1529,8 @@ long CtdlSaveMsg(struct CtdlMessage *msg, /* message to save */ struct SuppMsgInfo smi; FILE *network_fp = NULL; static int seqnum = 1; + struct CtdlMessage *imsg; + char *instr; lprintf(9, "CtdlSaveMsg() called\n"); if (is_valid_message(msg) == 0) return(-1); /* self check */ @@ -1678,10 +1680,25 @@ long CtdlSaveMsg(struct CtdlMessage *msg, /* message to save */ } /* For internet mail, drop a copy in the outbound queue room */ - /* FIX ... nothing's going to get delivered until we add - some delivery instructions!!! */ if (mailtype == MES_INTERNET) { CtdlSaveMsgPointerInRoom(SMTP_SPOOLOUT_ROOM, newmsgid, 0); + + /* And generate delivery instructions */ + lprintf(9, "Generating delivery instructions\n"); + instr = mallok(2048); + sprintf(instr, + "Content-type: %s\n\nmsgid|%ld\nsubmitted|%ld\n" + "remote|%s|0||\n", + SPOOLMIME, newmsgid, time(NULL), recipient ); + + imsg = mallok(sizeof(struct CtdlMessage)); + memset(imsg, 0, sizeof(struct CtdlMessage)); + imsg->cm_magic = CTDLMESSAGE_MAGIC; + imsg->cm_anon_type = MES_NORMAL; + imsg->cm_format_type = FMT_RFC822; + imsg->cm_fields['M'] = instr; + CtdlSaveMsg(imsg, "", SMTP_SPOOLOUT_ROOM, MES_LOCAL, 1); + CtdlFreeMessage(imsg); } /* Bump this user's messages posted counter. */ diff --git a/citadel/serv_smtp.c b/citadel/serv_smtp.c index 517e5d040..4c694c342 100644 --- a/citadel/serv_smtp.c +++ b/citadel/serv_smtp.c @@ -669,6 +669,20 @@ void smtp_command_loop(void) { +/* + * smtp_try() + * + * Called by smtp_do_procmsg() to attempt delivery to one SMTP host + * + */ +void smtp_try(char *key, char *addr, int *status, char *dsn) { + + *status = 3; + strcpy(dsn, "smtp_try() is not finished yet"); +} + + + /* * smtp_do_procmsg() * @@ -676,12 +690,16 @@ void smtp_command_loop(void) { */ void smtp_do_procmsg(long msgnum) { struct CtdlMessage *msg; - char *instr; + char *instr = NULL; + char *results = NULL; int i; int lines; - char buf[256]; - char key[256]; - long msgid = (-1); + int status; + char buf[1024]; + char key[1024]; + char addr[1024]; + char dsn[1024]; + long text_msgid = (-1); msg = CtdlFetchMessage(msgnum); if (msg == NULL) { @@ -689,12 +707,13 @@ void smtp_do_procmsg(long msgnum) { return; } - instr = msg->cm_fields['M']; + instr = strdoop(msg->cm_fields['M']); + CtdlFreeMessage(msg); /* Strip out the headers amd any other non-instruction line */ lines = num_tokens(instr, '\n'); for (i=0; i\n", buf); remove_token(instr, i, '|'); @@ -706,19 +725,68 @@ void smtp_do_procmsg(long msgnum) { /* Learn the message ID */ lines = num_tokens(instr, '\n'); for (i=0; i\n", addr); + smtp_try(key, addr, &status, dsn); + if (status != 2) { + if (results == NULL) { + results = mallok(1024); + memset(results, 0, 1024); + } + else { + results = reallok(results, + strlen(results) + 1024); + } + sprintf(&results[strlen(results)], + "%s|%s|%d|%s\n", + key, addr, status, dsn); + } + } + } + if (results != NULL) { + instr = reallok(instr, strlen(instr) + strlen(results) + 2); + strcat(instr, results); + phree(results); + } + /* Delete the instructions and replace with the updated ones */ + CtdlDeleteMessages(SMTP_SPOOLOUT_ROOM, msgnum, NULL); + msg = mallok(sizeof(struct CtdlMessage)); + memset(msg, 0, sizeof(struct CtdlMessage)); + msg->cm_magic = CTDLMESSAGE_MAGIC; + msg->cm_anon_type = MES_NORMAL; + msg->cm_format_type = FMT_RFC822; + msg->cm_fields['M'] = instr; + CtdlSaveMsg(msg, "", SMTP_SPOOLOUT_ROOM, MES_LOCAL, 1); CtdlFreeMessage(msg); } diff --git a/citadel/sysconfig.h b/citadel/sysconfig.h index 198f7e557..3ce4597f8 100644 --- a/citadel/sysconfig.h +++ b/citadel/sysconfig.h @@ -83,8 +83,8 @@ * These define what port to listen on for various services. * FIX ... put this in a programmable config somewhere */ -#define POP3_PORT 110 -#define SMTP_PORT 25 +#define POP3_PORT 1110 +#define SMTP_PORT 2525 /*