示例#1
0
 public void Reset()
 {
     findseed = null;
     origin   = new MapiRecipDesc();
     recpts.Clear();
     attachs.Clear();
     lastMsg = null;
 }
示例#2
0
        public void AddRecipientBCC(string name, string addr)
        {
            var dest = new MapiRecipDesc {
                recipClass = MapiBCC, name = name, address = addr
            };

            recpts.Add(dest);
        }
示例#3
0
        public void AddRecipient(string name, string addr, bool cc)
        {
            var dest = new MapiRecipDesc {
                recipClass = (cc ? MapiCC : MapiTO), name = name, address = addr
            };

            recpts.Add(dest);
        }
示例#4
0
		public void Reset()
		{
			findseed = null;
			origin = new MapiRecipDesc();
			recpts.Clear();
			attachs.Clear();
			lastMsg = null;
		}
示例#5
0
 protected internal MapiRecipDescW(MapiRecipDesc recipDesc)
 {
     reserved   = recipDesc.reserved;
     recipClass = recipDesc.recipClass;
     name       = recipDesc.name;
     address    = recipDesc.address;
     eIDSize    = recipDesc.eIDSize;
     entryID    = recipDesc.entryID;
 }
示例#6
0
        public void AddRecip(string name, string addr, bool cc)
        {
            MapiRecipDesc dest = new MapiRecipDesc();

            if (cc)
            {
                dest.recipClass = MapiCC;
            }
            else
            {
                dest.recipClass = MapiTO;
            }
            dest.name    = name;
            dest.address = addr;
            recpts.Add(dest);
        }
示例#7
0
        public bool SingleAddress(string label, out string name, out string addr)
        {
            name = null;
            addr = null;
            int    newrec = 0;
            IntPtr ptrnew = IntPtr.Zero;

            error = MAPIAddress(session, winhandle, null, 1, label, 0, IntPtr.Zero, 0, 0, ref newrec, ref ptrnew);
            if (error != 0 || newrec < 1 || ptrnew == IntPtr.Zero)
            {
                return(false);
            }

            var recip = new MapiRecipDesc();

            Marshal.PtrToStructure(ptrnew, recip);
            name = recip.name;
            addr = recip.address;

            MAPIFreeBuffer(ptrnew);
            return(true);
        }
示例#8
0
        // ----------------------------------------------------------- FINDING ---------

        public bool Next(ref MailEnvelop env)
        {
            error = MAPIFindNext(session, winhandle, null, findseed,
                                 MapiLongMsgID, 0, lastMsgID);
            if (error != 0)
            {
                return(false);
            }
            findseed = lastMsgID.ToString();

            IntPtr ptrmsg = IntPtr.Zero;

            error = MAPIReadMail(session, winhandle, findseed,
                                 MapiEnvOnly | MapiPeek | MapiSuprAttach, 0, ref ptrmsg);
            if ((error != 0) || (ptrmsg == IntPtr.Zero))
            {
                return(false);
            }

            lastMsg = new MapiMessage();
            Marshal.PtrToStructure(ptrmsg, lastMsg);
            MapiRecipDesc orig = new MapiRecipDesc();

            if (lastMsg.originator != IntPtr.Zero)
            {
                Marshal.PtrToStructure(lastMsg.originator, orig);
            }

            env.id      = findseed;
            env.date    = DateTime.ParseExact(lastMsg.dateReceived, "yyyy/MM/dd HH:mm", DateTimeFormatInfo.InvariantInfo);
            env.subject = lastMsg.subject;
            env.from    = orig.name;
            env.unread  = (lastMsg.flags & MapiUnread) != 0;
            env.atts    = lastMsg.fileCount;

            error = MAPIFreeBuffer(ptrmsg);
            return(error == 0);
        }
示例#9
0
		public bool SingleAddress(string label, out string name, out string addr)
		{
			name = null;
			addr = null;
			int newrec = 0;
			IntPtr ptrnew = IntPtr.Zero;
			error = MAPIAddress(session, winhandle, null, 1, label, 0, IntPtr.Zero,
			                    0, 0, ref newrec, ref ptrnew);
			if ((error != 0) || (newrec < 1) || (ptrnew == IntPtr.Zero))
				return false;

			var recip = new MapiRecipDesc();
			Marshal.PtrToStructure(ptrnew, recip);
			name = recip.name;
			addr = recip.address;

			MAPIFreeBuffer(ptrnew);
			return true;
		}
示例#10
0
		// ----------------------------------------------------------- FINDING ---------

		public bool Next(ref MailEnvelop env)
		{
			error = MAPIFindNext(session, winhandle, null, findseed,
			                     MapiLongMsgID, 0, lastMsgID);
			if (error != 0)
				return false;
			findseed = lastMsgID.ToString();

			IntPtr ptrmsg = IntPtr.Zero;
			error = MAPIReadMail(session, winhandle, findseed,
			                     MapiEnvOnly | MapiPeek | MapiSuprAttach, 0, ref ptrmsg);
			if ((error != 0) || (ptrmsg == IntPtr.Zero))
				return false;

			lastMsg = new MapiMessage();
			Marshal.PtrToStructure(ptrmsg, lastMsg);
			var orig = new MapiRecipDesc();
			if (lastMsg.originator != IntPtr.Zero)
				Marshal.PtrToStructure(lastMsg.originator, orig);

			env.id = findseed;
			env.date = DateTime.ParseExact(lastMsg.dateReceived, "yyyy/MM/dd HH:mm", DateTimeFormatInfo.InvariantInfo);
			env.subject = lastMsg.subject;
			env.from = orig.name;
			env.unread = (lastMsg.flags & MapiUnread) != 0;
			env.atts = lastMsg.fileCount;

			error = MAPIFreeBuffer(ptrmsg);
			return error == 0;
		}
示例#11
0
		public void AddRecipient(string name, string addr, bool cc)
		{
			var dest = new MapiRecipDesc {recipClass = (cc ? MapiCC : MapiTO), name = name, address = addr};
			recpts.Add(dest);
		}