added x-envelop-to: support to see the envelope recipient address

This commit is contained in:
SJ 2012-11-27 13:16:30 +01:00
parent 24672a02a1
commit 94a3e2d78b
5 changed files with 18 additions and 1 deletions

View File

@ -66,6 +66,20 @@ cipher_list=HIGH:MEDIUM
; piler's own header to indicate previously archived messages ; piler's own header to indicate previously archived messages
piler_header_field=X-piler: piler already archived this email piler_header_field=X-piler: piler already archived this email
; extra header field to treat as To:
;
; to make postfix to insert the envelope recipient address to the email
; header, do the following:
;
; /etc/postfix/main.cf:
;
; smtpd_recipient_restrictions = reject_non_fqdn_recipient, ... check_recipient_access pcre:$config_directory/x-add-envelope-to, ...
;
; /etc/postfix/x-add-envelope-to:
;
; /(.*)/ prepend X-Envelope-To: $1
;
extra_to_field=X-Envelope-To:
; whether to archive an email not having a Message-ID header line (1) ; whether to archive an email not having a Message-ID header line (1)
; or not (0). ; or not (0).

View File

@ -67,6 +67,7 @@ struct _parse_rule config_parse_rules[] =
{ "clamd_socket", "string", (void*) string_parser, offsetof(struct __config, clamd_socket), CLAMD_SOCKET, MAXVAL-1}, { "clamd_socket", "string", (void*) string_parser, offsetof(struct __config, clamd_socket), CLAMD_SOCKET, MAXVAL-1},
{ "debug", "integer", (void*) int_parser, offsetof(struct __config, debug), "0", sizeof(int)}, { "debug", "integer", (void*) int_parser, offsetof(struct __config, debug), "0", sizeof(int)},
{ "default_retention_days", "integer", (void*) int_parser, offsetof(struct __config, default_retention_days), "2557", sizeof(int)}, { "default_retention_days", "integer", (void*) int_parser, offsetof(struct __config, default_retention_days), "2557", sizeof(int)},
{ "extra_to_field", "string", (void*) string_parser, offsetof(struct __config, extra_to_field), "", MAXVAL-1},
{ "hostid", "string", (void*) string_parser, offsetof(struct __config, hostid), HOSTID, MAXVAL-1}, { "hostid", "string", (void*) string_parser, offsetof(struct __config, hostid), HOSTID, MAXVAL-1},
{ "iv", "string", (void*) string_parser, offsetof(struct __config, iv), "", MAXVAL-1}, { "iv", "string", (void*) string_parser, offsetof(struct __config, iv), "", MAXVAL-1},
{ "listen_addr", "string", (void*) string_parser, offsetof(struct __config, listen_addr), "127.0.0.1", MAXVAL-1}, { "listen_addr", "string", (void*) string_parser, offsetof(struct __config, listen_addr), "127.0.0.1", MAXVAL-1},

View File

@ -43,6 +43,7 @@ struct __config {
int session_timeout; int session_timeout;
char piler_header_field[MAXVAL]; char piler_header_field[MAXVAL];
char extra_to_field[MAXVAL];
unsigned char key[KEYLEN]; unsigned char key[KEYLEN];
unsigned char iv[MAXVAL]; unsigned char iv[MAXVAL];

View File

@ -13,7 +13,7 @@
#define VERSION "0.1.22" #define VERSION "0.1.22"
#define BUILD 727 #define BUILD 728
#define HOSTID "mailarchiver" #define HOSTID "mailarchiver"

View File

@ -348,6 +348,7 @@ int parse_line(char *buf, struct _state *state, struct session_data *sdata, int
else if(strncasecmp(buf, "Recipient:", strlen("Recipient:")) == 0) state->message_state = MSG_RECIPIENT; else if(strncasecmp(buf, "Recipient:", strlen("Recipient:")) == 0) state->message_state = MSG_RECIPIENT;
else if(strncasecmp(buf, "Date:", strlen("Date:")) == 0 && sdata->sent == 0) sdata->sent = parse_date_header(buf); else if(strncasecmp(buf, "Date:", strlen("Date:")) == 0 && sdata->sent == 0) sdata->sent = parse_date_header(buf);
else if(strncasecmp(buf, "Received:", strlen("Received:")) == 0) state->message_state = MSG_RECEIVED; else if(strncasecmp(buf, "Received:", strlen("Received:")) == 0) state->message_state = MSG_RECEIVED;
else if(cfg->extra_to_field[0] != '\0' && strncasecmp(buf, cfg->extra_to_field, strlen(cfg->extra_to_field)) == 0) state->message_state = MSG_TO;
if(state->message_state == MSG_MESSAGE_ID && state->message_id[0] == 0){ if(state->message_state == MSG_MESSAGE_ID && state->message_id[0] == 0){
p = strchr(buf+11, ' '); p = strchr(buf+11, ' ');