Improved code for getting the value of headers in rfc822 part