Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Decoding an e-mail subject 1

Status
Not open for further replies.

Griffyn

Programmer
Jul 11, 2002
1,077
AU
Hi all,

Using Indy, I have a TIdMessage with a Subject property that equals
[tt]
** SPAM ** =?gb2312?B?UmU6ICjI8NDHzOHKvi20y9PKvP6/ycTcysfArLv408q8/ik2MDE5TSBhbmQgNjAxOE0=?=
[/tt]
Outlook 2003 displays this message's subject as
[tt]
** SPAM ** Re: (????-??????????)6019M and 6018M
[/tt]
but displays the garbled subject when you examine the headers for the message.

As far as I can tell, the =? and ?= surrounds indicate MIME encoding, but when I try running a decoder over it, it comes out with gibberish. And shouldn't TIdMessage do the decoding automatically?

I'm getting the message using a TIdIMAP4 component and TIdIMAP4.UIDRetrieveHeaders, then streaming the TIdMessage via TCP to another program that then outputs the TIdMessage.Subject property. I'm going to keep tinkering with different things but can anyone give me a hand?
 
I think gb2312 is Chinese.

Getting answers before I'm asked.
Providing answers if I can.
 
Got it sorted. Found this component pack on this page of freeware Delphi stuff
Extracted the .DCUs in my Lib folder, and used this code
Code:
[navy][i]// for automatic syntax highlighting see faq102-6487 
[/i][/navy][b]uses[/b]
  IdMessage, KACDOMessage;
[b]var[/b]
  m : TIdMessage;
[b]begin[/b]
  [b]with[/b] TCDOCoder.Create [b]do[/b]
    [b]try[/b]
      m.Subject := DecodeString(m.Subject);
    [b]finally[/b]
      Free;
    [b]end[/b];
[b]end[/b];

I need to tweak it a little, coz the [tt]** SPAM **[/tt] bit is also being 'decoded' when it shouldn't, so I'll deal with that.

Thanks for setting me on the path ThunderForest, star for you.
 
This is too funny: you have to go to a Polish web site to get Chinese decoded!

Thanks for sharing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top