Hello there. I've run into the issue where From: headers aren't being filled out by the auto reply sub routines as there is no deliver-to header.
The only solution I've seen doing a search was to add a sendmail macro, but unfortuntely I'm running postfix. I never really thought this solution was good anyway, the MDA should be adding that header, not the MTA. I'll just post my main comment block in the file here, I'll be just rehashing if I didn't. /* * Requires: * userid = full realm email address * * Assumptions: * MIME_VALUE_MAX > column size of users.userid * * Thoughts: * Added Delivered-To Mime block into mime list as a temporary fix for * missing Auto Reply From: Fields * Delivered-to: header should be supplied by MDA which this is * There isn't an easy way to do this in the current architecture * As Alias->Username is many-to-one * No memory is non fatal for this code. * * Suggested Future Implementation: * Add Delivered-To for each message inserted * However this will probably require a re-write of insert-messages() * Due to alias information being lost during insertion of each message * Then re-read each message header to regenerate headerfields */ Any comments are welcome of course, and this will only be useful for admins using full realm email addresses for their pop/imap logins. Thanks Eric
diff -Naur dbmail-1.2.8a/pipe.c dbmail-1.2.8a-efung/pipe.c --- dbmail-1.2.8a/pipe.c 2004-06-09 00:01:35.000000000 +1000 +++ dbmail-1.2.8a-efung/pipe.c 2004-06-10 17:20:10.000000000 +1000 @@ -150,6 +150,8 @@ char *reply_body, *notify_address; FILE *instream = stdin; field_t val; + struct mime_record *delivered_to; + struct element *delivered_to_el; /* step 1. inserting first message @@ -468,7 +470,56 @@ trace(TRACE_DEBUG, "insert_messages(): no reply body specified, skipping auto-reply"); else { + /* + * Requires: + * userid = full realm email address + * + * Assumptions: + * MIME_VALUE_MAX > column size of users.userid + * + * Thoughts: + * Added Delivered-To Mime block into mime list as a temporary fix for + * missing Auto Reply From: Fields + * Delivered-to: header should be supplied by MDA which this is + * There isn't an easy way to do this in the current architecture + * As Alias->Username is many-to-one + * No memory is non fatal for this code. + * + * Suggested Future Implementation: + * Add Deliver-To for each message inserted + * However this will probably require a re-write of insert-messages() + * Due to alias information being lost during insertion of each message + * Then re-read each message header to regenerate headerfields + */ + delivered_to = (struct mime_record *)my_malloc(sizeof(struct mime_record)); + + if (!delivered_to) + { + trace(TRACE_ERROR, "insert_messages(): out of memory for delivered-to\n"); + } + else + { + strcpy(delivered_to->field, "Delivered-To"); + strcpy(delivered_to->value, auth_get_userid(&bounce_userid)); + if ( !list_nodeadd(headerfields,delivered_to,sizeof (*delivered_to))) + { + trace(TRACE_ERROR, "insert_messages(): cannot add element to list\n"); + my_free(delivered_to); + delivered_to = NULL; + } + } send_reply(headerfields, reply_body); + + if (!delivered_to) + { + delivered_to_el = list_nodepop(headerfields); + delivered_to = delivered_to_el->data; + my_free(delivered_to); + delivered_to = NULL; + my_free(delivered_to_el); + delivered_to_el = NULL; + } + my_free(reply_body); } } @@ -649,7 +700,19 @@ subject = record->value; trace(TRACE_DEBUG, "send_reply(): found SUBJECT [%s]", subject); } - else if (strcasecmp(record->field, "deliver-to") == 0) + /* + * Multiple Delivered-To Headers + * If a Delivered-To address is already in place, ignore. + * Internal mime record will always be popped first + * But old record kept in place in case of non-fatal error adding + * Internal record + */ + else if (strcasecmp(record->field, "delivered-to") == 0 && to == NULL) + { + to = record->value; + trace(TRACE_DEBUG, "send_reply(): found DELIVERED-TO [%s]", to); + } + else if (strcasecmp(record->field, "deliver-to") == 0 && to == NULL) { to = record->value; trace(TRACE_DEBUG, "send_reply(): found TO [%s]", to);