Пример #1
0
        private void MailEvents_ItemSend(IMailItem item, ref bool cancel)
        {
            bool?wantReport = (bool?)item.GetProperty(OutlookConstants.PR_ORIGINATOR_DELIVERY_REPORT_REQUESTED);

            if (wantReport == true)
            {
                Logger.Instance.Trace(this, "Delivery receipt request: {0}", item.EntryID);
                item.SetProperty(Constants.ZPUSH_RECEIPT_REQUESTS, Constants.ZPUSH_RECEIPT_REQUEST_DELIVERY);
            }
        }
Пример #2
0
        private void CheckBCC(IMailItem mail)
        {
            // If the item already has a BCC, assume it's correct
            if (!string.IsNullOrEmpty(mail.BCC))
            {
                return;
            }

            // Grab the transport headers
            string headers = (string)mail.GetProperty(OutlookConstants.PR_TRANSPORT_MESSAGE_HEADERS);

            if (string.IsNullOrEmpty(headers))
            {
                return;
            }

            // Check if there's a bcc header
            Match match = RE_BCC.Match(headers);

            if (match.Groups.Count < 2)
            {
                return;
            }
            string bcc = match.Groups[1].Value;

            if (string.IsNullOrEmpty(bcc))
            {
                return;
            }

            // Add the recipient
            string decoded = bcc.DecodeQuotedPrintable();

            try
            {
                using (IRecipients recipients = mail.Recipients)
                {
                    foreach (string entry in decoded.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None))
                    {
                        using (IRecipient recip = CreateRecipient(recipients, entry))
                        {
                            recip.Type = MailRecipientType.BCC;
                        }
                    }
                }
            }
            finally
            {
                mail.Save();
            }
        }
        private void SetReplyFlag(IMailItem mail, IMailItem response, Verb verb)
        {
            if (!UpdateOutgoing)
            {
                return;
            }

            string id = (string)mail.GetProperty(OutlookConstants.PR_ZPUSH_MESSAGE_ID);

            using (IFolder folder = mail.Parent)
            {
                string folderId = (string)folder.GetProperty(OutlookConstants.PR_ZPUSH_SYNC_ID);
                string value    = ReplyFlags.VerbToExchange(verb) + "/" + id + "/" + folderId;
                Logger.Instance.Trace(this, "Reply header: {0}", value);
                response.SetProperty(Constants.ZPUSH_REPLY_HEADER, value);
            }
        }