none
Custom Headers in SMTP Event Sink RRS feed

  • Question

  • I have implemented a VBScipt event sink to add a line in the text body and a couple custom headers in specific messages. Generally the script works as expected, with the exception that the custom headers inserted do not keep the values given.

    The script is running on an SMTP server (running on Windows 2003 R2 SP2 32-bit) that relays messages to our organization's Exchange 2003. The SMTP server is running on a different machine than Exchange, that resides inside a DMZ perimeter; SMTP server is configured as described in "XCON: How to Set up Windows 2000 as a SMTP Relay Server or Smart Host" (http://support.microsoft.com/kb/293800/)

    All messages are UTF-8, Base64 encoded, and text/plain. The values I want to pass to custom headers are UTF-8 strings; many times they are longer than 1024 bytes. Having in mind that the values in custom headers have to be encoded first, then passed to custom headers, I have used CAPICOM's Utilities class Base64Encode() method to encode my UTF-8 string values.

    I can verify that the values passed to custom headers during the sink event, are not the same with the values custom headers have when the message is delivered. I have seen messages from other organizations that include custom headers that their values are bigger that 1024 bytes; these values span in more than one line.

    Any ideas or pointers?

     

    George J.


    MVP(VSTO), Athens, Greece
    Monday, December 13, 2010 9:07 PM

All replies

  • I have located my problem - when I was setting values to custom headers, I had already Base64-encoded my values and set the necessary prefixes/suffixes according to RFC 1522.

    It seems that if the values are prefixed with =?utf-8?b?{Base64 encoded text}?= when Msg.DataSource.Save() occurs, header values are encoded again. This ends up on corrupting the values of the headers.

    I tried to set the values with the format =?utf-8?b?{plain text}?= with mixed results. Some values get encoded, some don't - for values that contain Latin characters only, it works, the conversion to Base64 is automatic; although for values that contain non-Latin character, e.g. Greek in my case, no conversion is happing I get "ugly" values in headers.

    Does anyone have any pointer which is the right way to do it?

     

    George J.


    MVP(VSTO), Athens, Greece
    Tuesday, December 14, 2010 4:28 PM