I just yesterday set up fetchmail[1] to fetch e-mail from yahoo over POP and deposit them in a self-hosted mailbox (for my partner's longstanding Yahoo e-mail address). It may be worth a look; it can fetch from IMAP or POP and spit them out to LMTP or SMTP. (N.B. it didn't work with IMAP on Yahoo for me, but using POP was no problem).
edit: Perhaps my /etc/fetchmailrc file can be a useful starting point for someone[2].