コード例 #1
0
ファイル: CnmEmailParser.cs プロジェクト: iraychen/toxy
        public ToxyEmail Parse()
        {
            if (!File.Exists(Context.Path))
                throw new FileNotFoundException("File " + Context.Path + " is not found");

            FileInfo fi = new FileInfo(Context.Path);
            CnmFile reader = new CnmFile(fi);
            reader.Parse();
            ToxyEmail email=new ToxyEmail();
            email.From = reader.From;
            email.To = new List<string>(reader.To.Split(';'));
            email.TextBody = reader.TextPlain;
            using (var sr=new StreamReader(reader.TextHtml))
            {
                email.HtmlBody = sr.ReadToEnd();
            }
            email.Subject = reader.Subject;
            return email;
        }
コード例 #2
0
ファイル: CnmEmailParser.cs プロジェクト: Sveer/Toxy.NetCore
        public ToxyEmail Parse()
        {
            if (!File.Exists(Context.Path))
            {
                throw new FileNotFoundException("File " + Context.Path + " is not found");
            }

            FileInfo fi     = new FileInfo(Context.Path);
            CnmFile  reader = new CnmFile(fi);

            reader.Parse();
            ToxyEmail email = new ToxyEmail();

            email.From     = reader.From;
            email.To       = new List <string>(reader.To.Split(';'));
            email.TextBody = reader.TextPlain;
            using (var sr = new StreamReader(reader.TextHtml))
            {
                email.HtmlBody = sr.ReadToEnd();
            }
            email.Subject = reader.Subject;
            return(email);
        }