public void parse(string text) { string[] ppls = text.Split(','); foreach (string ppl in ppls) { string addr = ppl.Trim(); if (addr.Length == 0) { continue; } Match m; if (null != (m = Rex.NameAndAddr.Match(addr)) && m.Success) { al.Add(new Person(m.Groups[2].Value, SubjectDecode.decode(m.Groups[1].Value))); } else if (null != (m = Rex.Addr.Match(addr)) && m.Success) { al.Add(new Person(m.Groups[1].Value)); } else { al.Add(new Person(SubjectDecode.decode(addr))); } } }
public void processHeader() { (mlTo = new People()).parse(getHeaderValue("To", "")); (mlCC = new People()).parse(getHeaderValue("Cc", "")); (mlFrom = new People()).parse(getHeaderValue("From", "")); (mlReturnPath = new People()).parse(getHeaderValue("Return-Path", "")); (mlReferences = new People()).parse(getHeaderValue("References", "")); (mlInReplyTo = new People()).parse(getHeaderValue("In-Reply-To", "")); (mlMessageID = new People()).parse(getHeaderValue("Message-ID", "")); mlSubject = SubjectDecode.decode(getHeaderValue("Subject", "")); mlContentType = new ContentTypeContainer(getHeaderValue("Content-Type", "")); mlContentTransferEncoding = new ContentTransferEncodingContainer(getHeaderValue("Content-Transfer-Encoding", "")); mlContentDisposition = new ContentDispositionContainer(getHeaderValue("Content-Disposition", "")); mlDate = (getHeaderValue("Date", "")); }