コード例 #1
0
ファイル: MimeHelper.cs プロジェクト: liaodong/ActiveSync
        public static SyncableEmail ToSyncableEmail(this byte[] mimeData)
        {
            var email      = new SyncableEmail();
            var mime       = LumiSoft.Net.Mime.Mime.Parse(mimeData);
            var mimeEntity = mime.MainEntity;

            if (mimeEntity.To != null)
            {
                var emailAddresses = EmailHelper.ToEmailAddress(mimeEntity.To.ToAddressListString());
                var to             = emailAddresses
                                     .Aggregate("", (current, emailAddress) => current + (emailAddress.ToString() + ";"));
                to       = to.Remove(to.Length - 1);
                email.To = to;
            }
            if (mimeEntity.Cc != null)
            {
                var emailAddresses = EmailHelper.ToEmailAddress(mimeEntity.Cc.ToAddressListString());
                var cc             = emailAddresses
                                     .Aggregate("", (current, emailAddress) => current + (emailAddress.ToString() + ";"));
                cc       = cc.Remove(cc.Length - 1);
                email.Cc = cc;
            }

            if (mimeEntity.From != null)
            {
                var emailAddresses = EmailHelper.ToEmailAddress(mimeEntity.From.ToAddressListString());

                var from = emailAddresses
                           .Aggregate("", (current, emailAddress) => current + (emailAddress.ToString() + ";"));
                from       = from.Remove(from.Length - 1);
                email.From = from;
            }


            email.Subject = mimeEntity.Subject;
            email.Body    = mime.BodyHtml;
            email.ReplyTo = mimeEntity.ReplyTo != null?mimeEntity.ReplyTo.ToAddressListString() : "";

            email.DateReceived = mimeEntity.Date;
            email.DisplayTo    = mimeEntity.From.ToAddressListString();
            //TODO
            email.Importance = EmailImportance.Normal;

            return(email);
        }
コード例 #2
0
 public SendMailResult SendMail(UserCredential userCredential, SyncableEmail email)
 {
     throw new System.NotImplementedException();
 }
コード例 #3
0
 public void ForwardEmail(UserCredential userCredential, SyncableEmail email)
 {
     throw new System.NotImplementedException();
 }
コード例 #4
0
 public SyncableEmail EditMail(UserCredential credential, SyncableEmail email)
 {
     return(new SyncableEmail());
 }
コード例 #5
0
 public EmailAppData(SyncableEmail email)
 {
     Email = email;
 }
コード例 #6
0
 public EmailAppData()
 {
     Email = new SyncableEmail();
 }
コード例 #7
0
ファイル: MimeHelper.cs プロジェクト: liaodong/ActiveSync
 public static byte[] ToMime(this SyncableEmail email)
 {
     return(new byte[1]);
 }