none
adding custom x-headers to outgoing emails RRS feed

  • Question

  • I trying to add custom x-headers to outgoing emails for specific users in exchange organisation.

    Kindly let me know the steps for each exchange version 2003/2007/2010.

    Thanks for your help!

    Wednesday, July 25, 2012 3:00 PM

Answers

  • for 2003 event sinks, for 2007\2010 the replacement transport agents.

    Using x headers with exchange
    http://gsexdev.blogspot.com/2004/08/using-x-headers-with-exchange.html#!/2004/08/using-x-headers-with-exchange.html

    Adding an X-header in an Exchange Routing Transport Agent in Exchange 2007
    http://gsexdev.blogspot.com/2007/09/adding-x-header-in-exchange-routing.html#!/2007/09/adding-x-header-in-exchange-routing.html


    James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com

    • Marked as answer by Abhi28 Thursday, August 16, 2012 6:45 AM
    Wednesday, July 25, 2012 3:09 PM
  • hi,

    Sorry for that, but i really want to know the meaning of manual way.

    If you want to add message header for some users, you can consider to use transport rule.

    You can do like this:

    Conditions:from a member of distribution list (you should create a DL and then add these users into the DL)

                       sent to users inside or outside the organization(choose outside)

    Actions:set header with value (you can set header like this: x-test-messageheader and set value like this:test)

    It apply to exchange 2007 and exchange 2010.

    hope can help you

    thanks,


    CastinLu

    TechNet Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com


    • Edited by Castinlu Thursday, July 26, 2012 7:38 AM
    • Marked as answer by Abhi28 Thursday, July 26, 2012 9:15 AM
    • Unmarked as answer by Abhi28 Sunday, August 12, 2012 1:31 PM
    • Marked as answer by Abhi28 Thursday, August 16, 2012 6:45 AM
    Thursday, July 26, 2012 7:37 AM
  • I really appreciate your help in resolving my issue.

    Have you got any confirmation yet, whether by modifying the transport agent code, headers will get add to P1 or P2 message?


    By RFC, x-headers are P2.
    ( and I am referring to RFC 822- which has been superseeded by 2822 and 5322 and they dont mention x-headers, but I digress...)

    Tuesday, August 14, 2012 9:55 PM
    Moderator
  • We are sending the journal report to external domains and with the transport rule settings, custom x-headers are getting added to the P2 message rather than the P1 envelop message.

    I am trying to know whether by modifying the transport agent code as mention in the below link, do the headers will get added to p1 message? 

    http://gsexdev.blogspot.com/2007/09/adding-x-header-in-exchange-routing.html#!/2007/09/adding-x-header-in-exchange-routing.html


    These will allways be P2 headers and is exactly the same as the Rule Action. The P1 headers are used by the recieving MTA to route the message to the next destination. AFAIK the recipeint MTA builds the enevelope based on the SMTP Conversation verbs eg RCPT TO etc. While you could create your own P1 header values they would be only valid on the MTA where they where created (if your sending to a external server). The exception to the rule is when you have two Exchange servers talking to each other and using the XEXCH50 Verb to send extended message transport envelope properties. If you loop though the envelope headers in a Transport Agent via

    QueuedMessage.MailItem.Properties

    You'll see the differance between what headers are availble when processing different messages.

    Cheers
    Glen


    • Edited by Glen ScalesMVP Wednesday, August 15, 2012 8:05 AM format issue
    • Proposed as answer by Jamestechman Wednesday, August 15, 2012 1:35 PM
    • Marked as answer by Abhi28 Thursday, August 16, 2012 6:44 AM
    Wednesday, August 15, 2012 8:04 AM

All replies

  • for 2003 event sinks, for 2007\2010 the replacement transport agents.

    Using x headers with exchange
    http://gsexdev.blogspot.com/2004/08/using-x-headers-with-exchange.html#!/2004/08/using-x-headers-with-exchange.html

    Adding an X-header in an Exchange Routing Transport Agent in Exchange 2007
    http://gsexdev.blogspot.com/2007/09/adding-x-header-in-exchange-routing.html#!/2007/09/adding-x-header-in-exchange-routing.html


    James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com

    • Marked as answer by Abhi28 Thursday, August 16, 2012 6:45 AM
    Wednesday, July 25, 2012 3:09 PM
  • Is there any manual way apart of writing a code?


    • Edited by Abhi28 Wednesday, July 25, 2012 4:11 PM
    Wednesday, July 25, 2012 4:02 PM
  • No there is no utility or alternative method. If only for specific users you can use an outlook com add in.

    http://ivasoft.com/


    James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com

    Wednesday, July 25, 2012 5:53 PM
  • Thanks James!

    This is for testing purpose so what if I want to add x-header for all the users who send email outside my organization. Is there manual way? Let me know it for all the Exchange versions.


    • Edited by Abhi28 Wednesday, July 25, 2012 8:39 PM
    Wednesday, July 25, 2012 8:38 PM
  • I just want to confirm the transport rule setting of "set header with value" is same as adding custom x-headers to the emails?

    Thursday, July 26, 2012 7:24 AM
  • hi,

    Sorry for that, but i really want to know the meaning of manual way.

    If you want to add message header for some users, you can consider to use transport rule.

    You can do like this:

    Conditions:from a member of distribution list (you should create a DL and then add these users into the DL)

                       sent to users inside or outside the organization(choose outside)

    Actions:set header with value (you can set header like this: x-test-messageheader and set value like this:test)

    It apply to exchange 2007 and exchange 2010.

    hope can help you

    thanks,


    CastinLu

    TechNet Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com


    • Edited by Castinlu Thursday, July 26, 2012 7:38 AM
    • Marked as answer by Abhi28 Thursday, July 26, 2012 9:15 AM
    • Unmarked as answer by Abhi28 Sunday, August 12, 2012 1:31 PM
    • Marked as answer by Abhi28 Thursday, August 16, 2012 6:45 AM
    Thursday, July 26, 2012 7:37 AM
  • We are sending the journal report to external domains and with the transport rule settings, custom x-headers are getting added to the P2 message rather than the P1 envelop message.

    I am trying to know whether by modifying the transport agent code as mention in the below link, do the headers will get added to p1 message? 

    http://gsexdev.blogspot.com/2007/09/adding-x-header-in-exchange-routing.html#!/2007/09/adding-x-header-in-exchange-routing.html


    Sunday, August 12, 2012 1:29 PM
  • I would think so since its using the standard mime class, but I would post in the dev forum for confirmation.

    qmQueuedMessage.MailItem.Message.MimeDocument;
    MimeNode lhLasterHeader = hlHeaderlist.LastChild


    James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com

    Sunday, August 12, 2012 5:50 PM
  • I really appreciate your help in resolving my issue.

    Have you got any confirmation yet, whether by modifying the transport agent code, headers will get add to P1 or P2 message?


    Tuesday, August 14, 2012 4:09 PM
  • Please post in the dev forum, or moderator please move\merge to dev forum.

    http://social.technet.microsoft.com/Forums/en-US/exchangesvrdevelopment/threads


    James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com

    Tuesday, August 14, 2012 7:38 PM
  • I really appreciate your help in resolving my issue.

    Have you got any confirmation yet, whether by modifying the transport agent code, headers will get add to P1 or P2 message?


    By RFC, x-headers are P2.
    ( and I am referring to RFC 822- which has been superseeded by 2822 and 5322 and they dont mention x-headers, but I digress...)

    Tuesday, August 14, 2012 9:55 PM
    Moderator
  • We are sending the journal report to external domains and with the transport rule settings, custom x-headers are getting added to the P2 message rather than the P1 envelop message.

    I am trying to know whether by modifying the transport agent code as mention in the below link, do the headers will get added to p1 message? 

    http://gsexdev.blogspot.com/2007/09/adding-x-header-in-exchange-routing.html#!/2007/09/adding-x-header-in-exchange-routing.html


    These will allways be P2 headers and is exactly the same as the Rule Action. The P1 headers are used by the recieving MTA to route the message to the next destination. AFAIK the recipeint MTA builds the enevelope based on the SMTP Conversation verbs eg RCPT TO etc. While you could create your own P1 header values they would be only valid on the MTA where they where created (if your sending to a external server). The exception to the rule is when you have two Exchange servers talking to each other and using the XEXCH50 Verb to send extended message transport envelope properties. If you loop though the envelope headers in a Transport Agent via

    QueuedMessage.MailItem.Properties

    You'll see the differance between what headers are availble when processing different messages.

    Cheers
    Glen


    • Edited by Glen ScalesMVP Wednesday, August 15, 2012 8:05 AM format issue
    • Proposed as answer by Jamestechman Wednesday, August 15, 2012 1:35 PM
    • Marked as answer by Abhi28 Thursday, August 16, 2012 6:44 AM
    Wednesday, August 15, 2012 8:04 AM