diff --git a/src/config.h b/src/config.h index 670d4b71..6a71769a 100644 --- a/src/config.h +++ b/src/config.h @@ -14,7 +14,7 @@ #define VERSION "0.1.25-rc3" -#define BUILD 876 +#define BUILD 877 #define HOSTID "mailarchiver" diff --git a/src/misc.c b/src/misc.c index 7050b750..e2e1f93d 100644 --- a/src/misc.c +++ b/src/misc.c @@ -193,12 +193,29 @@ int trimBuffer(char *s){ int extractEmail(char *rawmail, char *email){ - char *p; + char *p, *q1, *q2; memset(email, 0, SMALLBUFSIZE); + // extract both regular and VERP addresses, eg. + // aaa@aaa.fu and archive+user=domain.com@myarchive.local + p = strchr(rawmail, '<'); if(p){ + q1 = strchr(p+1, '+'); + if(q1){ + q2 = strchr(q1+1, '='); + if(q2){ + p = strchr(q2, '@'); + if(p){ + *p = '\0'; + *q2 = '@'; + snprintf(email, SMALLBUFSIZE-1, "%s", q1+1); + return 1; + } + } + } + snprintf(email, SMALLBUFSIZE-1, "%s", p+1); p = strchr(email, '>'); if(p){