SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Mar 2011
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to decode the email subject ?

    Hi..

    I have send a mail with Subject line as

    [BILLING #PHY-945-49853]: [Ticket #12622] Payment Method

    But in the source of the message the line is like below

    Subject: =?UTF-8?B?W1NBTEVTICNCQk4tOTM1LTM3OTE3XTogW1RpY2tldCAjMTI2MjJdIFBheW1lbnQ=?=
    =?UTF-8?B?IE1ldGhvZA==?=


    It is encoded in Base 64.How can i decode it back to the original subject line in English using php ? I have tried with the php base64_decode($subject) but it does not decode it to the original subject ([BILLING #PHY-945-49853]: [Ticket #12622] Payment Method)

    I'm also attaching a sample email message in this mail.



    sample

    Return-Path: .........
    X-Original-To: ..........
    Delivered-To: ........
    Received: ......
    X-DKIM: ........
    Received:....
    To: ....
    Subject: =?UTF-8?B?W1NBTEVTICNCQk4tOTM1LTM3OTE3XTogW1RpY2tldCAjMTI2MjJdIFBheW1lbnQ=?=
    =?UTF-8?B?IE1ldGhvZA==?=
    From: =?UTF-8?B?U0FWVllFSE9TVElORyBTQUxFUw==?=
    X-Priority: ..
    X-MSMail-Priority: normal
    X-MimeOLE: Produced By Kayako Fusion v4.01.204
    X-Mailer: Kayako Fusion v4.01.204
    Reply-To: .......
    Date: .....
    Content-Type: multipart/alternative;
    boundary="=_1.64496c432f57488924404b338155a2d7"
    MIME-Version: 1.0
    Message-Id: ....


    This is a message in MIME Format.
    If you see this, your mail reader does not support this format.

    --=_1.64496c432f57488924404b338155a2d7
    Content-Type: text/plain;
    charset="UTF-8"
    Content-Transfer-Encoding: quoted-printable
    Content-Disposition: inline



    ------------------------------------------------------
    Support Center:
    Content-Type: text/html;
    charset="UTF-8"
    Content-Transfer-Encoding: quoted-printable
    Content-Disposition: inline

    If anyone knows please help me....

  2. #2
    SitePoint Zealot RishikeshJha's Avatar
    Join Date
    Mar 2009
    Location
    INDIA
    Posts
    146
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it seems that the subject is blank due to some reason that is why you are getting this..
    Rishi

  3. #3
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    This occurs usually because one of your parameters contains a non-ASCII character in it, causing the headers to be UTF-8 Encoded.

    Base64 Decoding your data shows the following:
    Subject: [SALES #BBN-935-37917]: [Ticket #12622] Payment
    Metho <-- Hmmm....
    From: SAVVYEHOSTING SALE

    seems like your subject line is too long for the mail daemon, so it's mangling the result. But I could be wrong there.

  4. #4
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I've seen that format of characters before, but for the life of me cannot remember where. =34 =EF etc...

    It's encoded, but not base64...
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  5. #5
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    Er... yes, it is base64.

    ?UTF-8?B?

    ?CharacterSet?Enum(Q,B)?
    Q = Quoted Printable
    B = Base64

    It's worth pointing out that there's nothing WRONG with having the string encoded - it'll still come out on the other end correctly.

  6. #6
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Ahh, I see. Learning is awesome.

    So, am I imagining seeing something like =C34 in emails before?
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  7. #7
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    In the actual email itself? Shouldnt have gotten that far (Your local mail daemon (or is it the email program itself... not sure.) should have decoded the data back into readable form)....


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •