diff -urN ifmail-2.15dev5/ifgate/getmessage.c ifmail-2.15dev5.origin.future/ifgate/getmessage.c
--- ifmail-2.15dev5/ifgate/getmessage.c	1999-03-31 17:14:32.000000000 +0300
+++ ifmail-2.15dev5.origin.future/ifgate/getmessage.c	2004-07-19 18:19:14.000000000 +0300
@@ -62,6 +62,17 @@
 	off_t endmsg_off,tear_off,orig_off,via_off;
 	FILE *fp;
 
+#ifdef INSERT_ORGANIZATION
+        char *msgid_value = NULL;
+        char *replyto_value = NULL;
+        faddr *addr_from_kludge = NULL;
+#endif
+#ifdef EDIT_FUTURE_DATES
+	time_t now=0L;
+	struct tm *ptm;
+	int now_year;
+	unsigned long date_fuzz=24L*60L*60L;
+#endif			
 	tmsg=&kmsg;
 
 	switch(tmp=iread(pkt))
@@ -220,6 +231,13 @@
 			while (isspace(*r)) r++;
 			(*tmsg)->key=xstrcpy(l);
 			(*tmsg)->val=xstrcpy(r);
+#ifdef INSERT_ORGANIZATION
+                        /* keep the values from MSGID and/or REPLYTO */
+                        if (!strncmp(l, "MSGID", 5) && msgid_value == NULL)
+			    msgid_value=xstrcpy(r);
+                        if (!strncmp(l, "REPLYTO", 7) && replyto_value == NULL)
+			    replyto_value=xstrcpy(r);
+#endif
 		}
 		tmsg=&((*tmsg)->next);
 
@@ -353,6 +371,54 @@
 	if (hdr("Origin",kmsg) && orig_off==0L)
 		while (removehdr("Origin",&kmsg) == 0);
 
+#ifdef INSERT_ORGANIZATION
+        /*if message has no origin, do try to get the address from MSGID or REPLYTO*/
+        if (!orig_off && newsmode) {
+            debug(5, "Origin not found. Get the address from MSGID or REPLYTO");
+            if (msgid_value != NULL) {
+                if ((r=strchr(msgid_value, ' ')) != NULL) {
+                    *r = '\0';
+                    addr_from_kludge=parsefnode(msgid_value);
+                }
+            }
+            if (addr_from_kludge == NULL && replyto_value != NULL) {
+                if ((r=strchr(replyto_value, ' ')) != 0) {
+                    *r = '\0';
+                    addr_from_kludge=parsefnode(replyto_value);
+                }
+            }
+            if (addr_from_kludge != NULL) {
+                f.point=addr_from_kludge->point;
+                f.node=addr_from_kludge->node;
+                f.net=addr_from_kludge->net;
+                f.zone=addr_from_kludge->zone;
+                if (addr_from_kludge->domain) f.domain=addr_from_kludge->domain;
+                addr_from_kludge->domain=NULL;
+                tidy_faddr(addr_from_kludge);
+            }
+            else {
+                debug(5, "FTN-address not found in kludges MSGID or REPLYTO");
+            }
+        }
+        if (msgid_value) free(msgid_value);
+        if (replyto_value) free(replyto_value);
+#endif
+#ifdef EDIT_FUTURE_DATES
+	time(&now);
+	if (newsmode && (mdate > now + date_fuzz)) {
+	    debug(5,"message date in the future \"%s\"",rfcdate(mdate));
+	    ptm = localtime(&now);
+	    now_year = ptm->tm_year;
+	    ptm = localtime(&mdate);
+	    ptm->tm_year = now_year;
+	    mdate=mktime(ptm);
+	    if (mdate > now + date_fuzz) {
+		ptm->tm_year = now_year - 1;
+		mdate=mktime(ptm);
+	    }
+	    debug(5,"new message date \"%s\"",rfcdate(mdate));
+	}
+#endif
 	endmsg_off=ftell(fp);
 	if ((tear_off) && (tear_off < endmsg_off)) endmsg_off=tear_off;
 	if ((orig_off) && (orig_off < endmsg_off)) endmsg_off=orig_off;
diff -urN ifmail-2.15dev5/ifgate/mkrfcmsg.c ifmail-2.15dev5.origin.future/ifgate/mkrfcmsg.c
--- ifmail-2.15dev5/ifgate/mkrfcmsg.c	1999-08-16 18:57:24.000000000 +0300
+++ ifmail-2.15dev5.origin.future/ifgate/mkrfcmsg.c	2004-07-19 18:20:00.000000000 +0300
@@ -520,12 +520,28 @@
 		}
 	}
 
+#ifndef INSERT_ORGANIZATION
 	if ((p=hdr("Organization",msg))) fprintf(pip,"Organization:%s",p);
 	else if ((p=hdr("RFC-Organization",kmsg)))
 		fprintf(pip,"Organization: %s",p);
 	else if ((p=hdr("Organization",kmsg)))
 		fprintf(pip,"Organization: %s",p);
 	else if (orig) fprintf(pip,"Organization: %s\n",orig);
+#else
+	p=hdr("Organization",msg);
+	if (p == NULL) p=hdr("RFC-Organization",kmsg);
+	if (p == NULL) p=hdr("Organization",kmsg);
+	if ((p == NULL) && orig) p=orig;
+	if (newsmode && ((p == NULL) || (strspn(p," \t\n\r") == strlen(p))))
+	    p=" Unknown\n";
+	if (p)
+	{
+	    fprintf(pip,"Organization:");
+	    if (p[0] != ' ') fprintf(pip,"%c",' ');
+	    fprintf(pip,"%s",p);
+	    if (p[strlen(p)-1] != '\n') fprintf(pip,"%c",'\n');
+	}
+#endif
 
 	for (tmsg=msg;tmsg;tmsg=tmsg->next)
 	{
