diff --git a/kmime/kmime_header_parsing.cpp b/kmime/kmime_header_parsing.cpp --- a/kmime/kmime_header_parsing.cpp +++ b/kmime/kmime_header_parsing.cpp @@ -1208,6 +1208,10 @@ scursor = oldscursor; } else { // succeeded: eat CFWS + if (*scursor == '@') { + maybeDisplayName += QLatin1Char('@'); + scursor++; + } eatCFWS( scursor, send, isCRLF ); if ( scursor == send ) { return false; diff --git a/kmime/tests/auto/headertest.cpp b/kmime/tests/auto/headertest.cpp --- a/kmime/tests/auto/headertest.cpp +++ b/kmime/tests/auto/headertest.cpp @@ -291,6 +291,25 @@ QCOMPARE( names.takeFirst(), QString( "Who?" ) ); QCOMPARE( h->as7BitString( false ), QByteArray( "Mary Smith , jdoe@example.org., Who? " ) ); delete h; + + { + // wrong formatted emailaddress + h = new Headers::Generics::AddressList(); + h->from7BitString("\"test@\" "); + QCOMPARE(h->addresses().count(), 1); + QCOMPARE(h->addresses().first(), QByteArray("test@example.org")); + QCOMPARE(h->displayNames().first(), QString("test@")); + delete h; + } + { + // wrong formatted emailaddress + h = new Headers::Generics::AddressList(); + h->from7BitString("test@ "); + QCOMPARE(h->addresses().count(), 1); + QCOMPARE(h->addresses().first(), QByteArray("test@example.org")); + QCOMPARE(h->displayNames().first(), QString("test@")); + delete h; + } } void HeaderTest::testMailboxListHeader()