Example #1
0
 private MailAddressCollection LoadTo()
 {
     foreach (Field field in m_Fields)
     {
         if (field.Name != null)
         {
             if (field.Name.ToLower().Equals("to"))
             {
                 IFieldParserProxy parser =
                     FieldParserProxy.Getinstance();
                 if (parser.AddrSpec.IsMatch(field.Body))
                 {
                     MailAddressCollection addresses = new MailAddressCollection();
                     MatchCollection       matches   =
                         parser.AddrSpec.Matches(field.Body);
                     foreach (Match match in matches)
                     {
                         addresses.Add(match.Value);
                     }
                     return(addresses);
                 }
             }
         }
     }
     return(null);
 }
Example #2
0
        private MailAddressCollection LoadAdressCollection(string fieldBody)
        {
            IFieldParserProxy parser =
                jingxian.mail.mime.FieldParserProxy.Getinstance();

            if (parser.AddrSpec.IsMatch(fieldBody))
            {
                MailAddressCollection addresses = new MailAddressCollection();
                try
                {
                    addresses.Add(fieldBody);
                }
                catch (FormatException)
                {
                    MatchCollection matches =
                        parser.AddrSpec.Matches(fieldBody);
                    foreach (Match match in matches)
                    {
                        addresses.Add(match.Value);
                    }
                }
                return(addresses);
            }

            return(null);
        }
Example #3
0
 public MailReader()
 {
     m_Decoders = new List <RFC2045.IDecoder>();
     m_Decoders.Add(new QuotedPrintableDecoder());
     m_Decoders.Add(new Base64Decoder());
     m_FieldParser = FieldParserProxy.Getinstance();
     m_FieldParser.CompilePattern();
 }
Example #4
0
 public static IFieldParserProxy Getinstance()
 {
     if (s_Proxy == null)
     {
         s_Proxy = new FieldParserProxy();
     }
     return(s_Proxy);
 }
Example #5
0
        public static string ParseAddress(string data)
        {
            IFieldParserProxy proxy = Getinstance();

            if (proxy.AddrSpec.IsMatch(data))
            {
                return(proxy.AddrSpec.Match(data).Value);
            }
            else
            {
                return(string.Empty);
            }
        }
Example #6
0
 public MailReader(IList <IDecoder> decoders, IFieldParserProxy proxy) : this(decoders)
 {
     m_FieldParser = proxy;
     m_FieldParser.CompilePattern();
 }
Example #7
0
        public static void ParseFields(ref IList <RFC822.Field> fields, ref string fieldString)
        {
            IFieldParserProxy proxy = Getinstance();

            proxy.Parse(ref fields, ref fieldString);
        }