Circular e-mail RRS feed

  • Question

  • Hi,
    i need to write an application for responding an incomming mail to Exchange Server 2007 SP1. I tried to use Echange Web Services (C# 3.5) and it works fine.
    But now I have a problem, what if someone has the same application? How shall I verify, that incomming mail is new, not circular mail? Could you suggest me some solution?

    Thank you.

    Monday, June 14, 2010 1:06 PM

All replies

  • Have you considered making the replyto email address different?


    Monday, June 14, 2010 3:26 PM
  • Thanks for your answer, this could be possible, but I would like to keep off, because it is the "info" mailbox for general communication.
    Monday, June 14, 2010 6:25 PM
  • Your alternative would be to look at the content of the email.

    How hard that would be depends on what the emails contain in the first place.

    Tuesday, June 15, 2010 8:47 AM
  • I tried to use an extended Properties, but when I create ResponseMessage (using CreateReply method of MaiMessage), it seems original Extended Properties are lost. And ReplyMessage has no Extended Properties method...

    Next, I hoped I can use X-Headers, but neither MailMessage nor ReplyMessage has such propery.

    My code to creating reply:

    ItemView view = new ItemView(int.MaxValue);
    ExtendedPropertyDefinition extendedPropertyDefinition =
      new ExtendedPropertyDefinition(appGuid, "replylevel", MapiPropertyType.String);
    view.PropertySet =
      new PropertySet(BasePropertySet.IdOnly, ItemSchema.Subject, extendedPropertyDefinition);
    FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, view);
    // Search the e-mail collection for the extended property.
    foreach (EmailMessage item in findResults.Items)
      int replyLevel = 0;   //Extended property - count of replies
      if (item.ExtendedProperties.Count > 0)
       // Display the extended name and value of the extended property.
       foreach (ExtendedProperty extendedProperty in item.ExtendedProperties)
         if (extendedProperty.PropertyDefinition.Name.ToLower() == "replylevel")
          replyLevel = Convert.ToInt32(extendedProperty.Value);
         string msg = string.Format("{0}\nExtended Property Name: {1} - Extended Property Value: {2}"
          , item.Subject
          , extendedProperty.PropertyDefinition.Name
          , extendedProperty.Value);
      if (replyLevel < 3)
       item.SetExtendedProperty(extendedPropertyDefinition, ++replyLevel);
       ResponseMessage msgReply = item.CreateReply(false);
       MessageBox.Show("Replylevel is 3, probaby it is circular mail");
    Wednesday, June 16, 2010 6:32 AM