From owner-freebsd-questions@FreeBSD.ORG Sat Jan 28 16:13:40 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E988106564A for ; Sat, 28 Jan 2012 16:13:40 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (smtp6.infracaninophile.co.uk [IPv6:2001:8b0:151:1:3cd3:cd67:fafa:3d78]) by mx1.freebsd.org (Postfix) with ESMTP id A72508FC0C for ; Sat, 28 Jan 2012 16:13:39 +0000 (UTC) Received: from seedling.black-earth.co.uk (seedling.black-earth.co.uk [IPv6:2001:8b0:151:1:fa1e:dfff:feda:c0bb]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.5/8.14.5) with ESMTP id q0SGDYt6037186 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Sat, 28 Jan 2012 16:13:35 GMT (envelope-from m.seaman@infracaninophile.co.uk) X-DKIM: OpenDKIM Filter v2.4.3 smtp.infracaninophile.co.uk q0SGDYt6037186 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=infracaninophile.co.uk; s=201001-infracaninophile; t=1327767215; bh=XORGsIfwSN0RGADYt60q9o7IM12wHCiFNE9qKludJ/E=; h=Message-ID:Date:From:MIME-Version:To:Subject:References: In-Reply-To:Content-Type:Cc; b=wQ91MiXfMMBS2plBu82nMoFdePcsjlrRvZej5yTlPoHSK2wUY6Z5MAKzKW4qZxdL0 yiMdiJ8Gbfz+m8R8YfB2vY8UAjCxV2AmIoE39HGRIHehI1GAHDuOLZqvi5Xxm6ChDm Eu6yU2jWeRIrq75eOtmBUYxGheb9FHrN5PN0Q7S4= Message-ID: <4F241EA2.8050805@infracaninophile.co.uk> Date: Sat, 28 Jan 2012 16:13:22 +0000 From: Matthew Seaman User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <4F23FAA1.5020700@herveybayaustralia.com.au> In-Reply-To: <4F23FAA1.5020700@herveybayaustralia.com.au> X-Enigmail-Version: 1.3.4 OpenPGP: id=60AE908C Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig26E3D3F99DE942A1F8969CF5" X-Virus-Scanned: clamav-milter 0.97.3 at lucid-nonsense.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lucid-nonsense.infracaninophile.co.uk Subject: Re: OT: perl mail problems X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2012 16:13:40 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig26E3D3F99DE942A1F8969CF5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 28/01/2012 13:39, Da Rock wrote: > I know this is not exactly FreeBSD related, but I'm in need of a monk > that can enlighten me on a sacred incantation to connect perl to an ima= p > server using Mail::Box modules :) If it helps people sleep, its all > running only on FreeBSD systems... >=20 > I have googled and searched, and googled some more, and tested, and the= n > went back to the drawing board and googled yet again... there is simply= > no clear answer out there. All the docs are very disjointed from my > reckoning- with no clear direction that explains how you get from a-b. >=20 > I have enabled a connection (I think - based on my tests and logs), but= > I cannot get further than that. I have a Mail::Box::Manager > instantiated, and then I have to use Mail::Box::IMAP4 to open a > connection to the server. From there I need to get a list of the folder= s > available- and thats where I get stymied. >=20 > All the docs are pop3 based, or maildir based, or mbox. The imap is ver= y > sketchy... and what is out there says to basically connect, and then > there is a jump to folders and messages with no idea of what is involve= d > in between. Although I did see one complete example with pop3, but it > won't work for imap. This is absolutely typical -- IMAP is frequently treated as POP-with-extra-bits, which really makes no sense whatsoever. There's a fundamental difference in behaviour to do with where the mail is actually stored. Anything that works by connecting to an IMAP server and downloading all the new messages to hold and read locally really is missing the point. > One of the biggest problems is the username confuses any other module > method than the Mail::Box::IMAP4 - the syntax is user@domain, and so if= > I use Mail::Box::Manager it will compile it into a url form ie > imap4://user@domain:password@mail.server which it obviously barfs on an= d > refuses to look beyond user@domain. Yeah, IMAP4 doesn't do URL-style things itself, so this is a fiction invented to appease the higher layers of Mail::Box. Unfortunately, '@' is of syntactic significance to URL schemes, making it difficult to incorporate usernames containing it. Hmmm.... can you substitute a hex encoded character string in that username? %40 should be the encoding for an @ character. > I really seem to be missing something fundamental here. I'm only trying= > to create some tools which will handle some situations apparently only > local to my systems, and improve my perl foo before I start creating > modules of my own and testing mod_perl. >=20 > If someone can help clear this up I'll be happy to communicate off list= > if that is necessary. Is all the e-mail you have to deal with stored on your IMAP4 server? If so, then using Mail::IMAPClient directly[*] might serve you better rather than through the Mail::Box and Mail::Transport classes. However, that's a much lower level interface and you'll need to be fairly au-fait with RFC 3501. (That's not as bad as it sounds: all it boils down to is finding what the command is called in the IMAP protocol when you want to achieve a particular effect.) One thing that I notice on a cursory reading of Mail::Box::IMAP4 is that it seems to assume things about the behaviour of the IMAP message store which aren't necessarily true for all different IMAP servers. (ICBW -- it was a /very/ cursory reading.) Usernames of the form 'name@example.com' are one of those things you can do with IMAP which tend to come as a bit of a surprise to people used to other mailclient protocols. Cheers, Matthew [*] Mail::Box et al use Mail::IMAPClient behind the scenes. --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate JID: matthew@infracaninophile.co.uk Kent, CT11 9PW --------------enig26E3D3F99DE942A1F8969CF5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.16 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk8kHq4ACgkQ8Mjk52CukIwpXACdFQkaVBK/tthPF7mv0Ths98RO q3oAnRlDkIrEXdYdFLBnuEWswaDn4UGK =RVn6 -----END PGP SIGNATURE----- --------------enig26E3D3F99DE942A1F8969CF5--