Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions MessageBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ internal static NameValueCollection ParseMailHeader(string header) {
private static NameValueCollection ParseMIMEField(string field) {
NameValueCollection coll = new NameValueCollection();
try {
MatchCollection matches = Regex.Matches(field, "([\\w\\-]+)=\"?([\\w\\-\\/\\.]+)");
MatchCollection matches = Regex.Matches(field, "([\\w\\-]+)=((['\"]).*?\\2|[^;\\n]*)");
foreach (Match m in matches)
coll.Add(m.Groups[1].Value, m.Groups[2].Value);
Match mvalue = Regex.Match(field, @"^\s*([\w\/]+)");
Expand All @@ -148,7 +148,7 @@ private static MailAddress[] ParseAddressList(string list) {
string[] addr = list.Split(',');
foreach (string a in addr) {
Match m = Regex.Match(a.Trim(),
@"(.*)\s*<?([A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4})>?",
@"(.*)\s*<?([A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,})>?",
RegexOptions.IgnoreCase | RegexOptions.RightToLeft);
if (m.Success) {
// The above regex will erroneously match some illegal (very rare)
Expand Down Expand Up @@ -446,4 +446,4 @@ private static Bodypart BodypartFromMIME(MIMEPart mimePart) {
return p;
}
}
}
}