Popcorn Dave has asked for the wisdom of the Perl Monks concerning the following question:

Fellow monks,

I'm working on a project where I send an encoded web based form as an e-mail and want to retrieve it via a web based client on the other end.

The encryption is working just fine on both encoding and decoding - that is if I look at the message in my e-mail client. However when I try getting the message using Mail::POP3Client, it appears to be losing some line breaks along the way as shown by the PGP snippets below.

What I'm getting -----BEGIN PGP MESSAGE----- Version: Crypt::OpenPGP 1.03 hQIOA3d7Jqbzm +ZZ1EAgAggmlYb1TnK+xTIw4jmxEfIn78S+6tNccDK3576FRJxKZ --clipped-- KoaBzlX71FsQUXLNPPjy9OyG/ikB6U4SZJ0LrRetb+KlAhKdvo8ygZKajilHsEm8 Z9lEE +16m =3D1k9I -----END PGP MESSAGE----- What it should be: -----BEGIN PGP MESSAGE----- Version: Crypt::OpenPGP 1.03 hQIOA3d7JqbzmZZ1EAgAsGxJsR3nzBWKi9JDUpMGhRoCnPTPPHp/61nMKnsL8EWI --clipped-- BeX+Hm9fh/UAeeHPClTq2JuDY1EEqg== =YcK/ -----END PGP MESSAGE-----

As you can see, the -----BEGIN and the Version should be on seperate lines ( as they show up in my e-mail client ) but they aren't.

I keep getting error messages of a bad checksum, which I am thinking is directly related to the message formatting being messed up. Can someone either reccomend how to solve the problem at hand or is there a different module I should be looking at for retrieving e-mail?

Useless trivia: In the 2004 Las Vegas phone book there are approximately 28 pages of ads for massage, but almost 200 for lawyers.

Replies are listed 'Best First'.
Re: Mail::Pop3Client messing up PGP email messages
by izut (Chaplain) on May 29, 2006 at 18:58 UTC

    Try Net::POP3 for retrieving your messages. It plays well with MIME-tools.

    Igor 'izut' Sutton
    your code, your rules.

      Thanks for the suggestion! That's retreving the e-mail the way it should be formatted. However...

      Upon further investigation of my problems, in the encrypted text I'm retrieving, the last 3 = are replaced with =3D, thereby messing up the CRC of the encrypted text. GPG throws a CRC error when I try to decode it manually. However, like I said before, when I retrieve said e-mails in Thunderbird, the =3D is just =.

      Any ideas on what's causing this mix up? It doesn't seem to be the encryption as that's coming through just fine.

      Thanks!

      Useless trivia: In the 2004 Las Vegas phone book there are approximately 28 pages of ads for massage, but almost 200 for lawyers.
        That sounds like maybe the message is PGP-signed, then MIME-encoded. If that's the case, to check it you'll have to MIME-decode it (which will change the =3D to just =) then check the signature.
Re: Mail::Pop3Client messing up PGP email messages
by traveler (Parson) on May 29, 2006 at 23:02 UTC
    Without seeing code it is hard to guess, but some options are UTF8 issues, *nix/Win32 newlines, and some other encoding problems.
      That was my original thought too, but I think sgifford may have hit the nail on the head with the MIME decoding idea.

      Useless trivia: In the 2004 Las Vegas phone book there are approximately 28 pages of ads for massage, but almost 200 for lawyers.