support for VERP addresses

This commit is contained in:
SJ 2014-06-30 16:10:36 +02:00
parent 284c434612
commit 39a2e6a306
2 changed files with 19 additions and 2 deletions

View File

@ -14,7 +14,7 @@
#define VERSION "0.1.25-rc3" #define VERSION "0.1.25-rc3"
#define BUILD 876 #define BUILD 877
#define HOSTID "mailarchiver" #define HOSTID "mailarchiver"

View File

@ -193,12 +193,29 @@ int trimBuffer(char *s){
int extractEmail(char *rawmail, char *email){ int extractEmail(char *rawmail, char *email){
char *p; char *p, *q1, *q2;
memset(email, 0, SMALLBUFSIZE); memset(email, 0, SMALLBUFSIZE);
// extract both regular and VERP addresses, eg.
// aaa@aaa.fu and archive+user=domain.com@myarchive.local
p = strchr(rawmail, '<'); p = strchr(rawmail, '<');
if(p){ 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); snprintf(email, SMALLBUFSIZE-1, "%s", p+1);
p = strchr(email, '>'); p = strchr(email, '>');
if(p){ if(p){