Email Access Via Android Device

Home » CentOS » Email Access Via Android Device
CentOS 9 Comments

I’m pretty sure that this is possible, but I don’t currently know enough about email to know where to start.

My main desktop computer runs CentOS 6 and my preferred email client is Sylpheed, which supports both POP and IMAP email, and my “internal network” has a static IP address, so getting access to the computer from the big scary world via my phone isn’t a problem.

I have six different email accounts that live on various servers. I have Sylpheed set up to poll each account once every ten minutes using POP3 and download all incoming mail. Upon receipt, I have a whole lot of filters in Sylpheed to sort the mail into various subdirectories of my Mail directory. For example, one of my directory structures under Mail is inbox/1/2, and email may be sorted in Mail/inbox or Mail/inbox/1 or Mail/inbox/1/2, or other subdirectories outside of inbox like, for example, Mail/3. In short, I
have a dozen or so subdirectories that Sylpheed sorts mail into based on various criteria like From or Subject.

What I would like to do is somehow make this whole thing available on my Android phone (Samsung Galaxy 3). As it sits right now, if I am not sitting in front of my computer the only way I can check my email is to SSH into it and look at the files in each of those subdirectories using a text utility like less; this is really inconvenient and I can’t reply to emails that way until I
get back in front of my computer.

I’m thinking that I need to run some kind of a mailserver on my computer that can be accessed by both Sylpheed locally and by ??? on my Android device. I get the impression that if I wanted to hand all of my email over to gmail I could then have something like this working. I don’t particularly want to do that; I would rather have something running on my own machine to do it.

I could use something else to poll for my email (fetchmail?). Sylpheed does have a configuration setting that I’m not currently using that says “Enable strict checking of summary caches — enable this if the contents of the folders may be changed by other applications” so based on that I think it can handle having messages magically changed by a program on my Android device.

What is the best way to approach this? My best idea so far is to set up fetchmail (or something) to do the pop downloads of incoming mail, and have some kind of a local imap server running though which I access the actual mail via any email client that can work with an imap account. Then I can set up Sylpheed to access only one account, that being the one on my local computer, and run some imap-using mail client on the Android device for remote access.

Having never actually used an imap email account in this way, that leads to a couple of other questions. (The only thing I’ve ever done with imap is set up squirrelmail.) What about filtering the email into those directories?
Procmail? And what happens to sent email — I assume that the SMTP part of the mail client wouldn’t actually change — I would still send outbound mail directly through the mailserver where my email account exists, right? But does it (can it) also send a copy to the imap mail store so I can send email from Android and later on review what I sent with Sylpheed?

9 thoughts on - Email Access Via Android Device

  • You could set up VNC on your desktop port forward to you desktop so you can use a VNC viewer on the S3, the just use you normal desktop, but from your phone. I do this, so I know it works.

  • the one you already mentioned:

    set up fetchmail or equivalent to put incoming messages to local maildir format mailboxes, and dovecot to serve them to any local or remote client.

    You’ll still have to handle how to _send_ email, probably, but reading email will just work from sylpheed, android clients or anything else you may want to use in the future.


  • Hard to beat a free gmail account – if you are concerned about privacy, you probably shouldn’t be sending the stuff over the internet in the first place. But, the tools are available to run your own imap server so you can see the same mailboxes from multiple devices.
    Alternatively your android device is perfectly capable of dealing with 6 remote servers directly.

    Start with dovecot configured to run imap or the ssl variation and using maildir format. I don’t know anything about sylpheed, but most mailers that know pop and imap can push to imap folders. So, if you want to continue using sylpheed and let it run all the time you might be able to simply connect it to the new imap account, create a matching folder structure there, drag all of your current mail to the corresponding folders, and change the rules for new messages to send them there. Then the android connected to the same account will see the same folders and contents.

    If you don’t want to leave sylpheed running all the time for the polling and rule processing, you can replace it with fetchmail and procmail. If your other accounts support imap, there is also something called imapsync that can copy or move messages between accounts. If your concern with gmail is only that you want your own archive for reliability, you could let them do the processing work and
    (probably) act as your normal mail host, but use imapsync to pull your own archive copy. I think gmail has some rate limit so you probably don’t want to wait till you’ve filled a 15 GB mailbox before you start to sync, though…

  • I figure that if my data lives on my computer, I know where it is and I can read it, search it, back it up and delete it anytime I want.

    I learned a long time ago that if you see something on the Internet that you think you might want to refer to in the future, get it now because it might not be there tomorrow.

    Having given this matter considerable thought over the past couple of days (and given Google a work-out too), here is my current plan, subject to any of you folks telling me where I’m going wrong. (I’m thinking that once I have this all set up and working I’ll write a little article about how to do it and post it on my website.)

    I plan to use fetchmail in daemon mode to poll all six mailservers for incoming mail, postfix to put incoming mail into a Maildir in my home directory, set up dovecot and point Sylpheed at that to read new and existing mail.

    For outbound mail my best idea so far is to set up postfix to send outbound mail via the appropriate mailserver by checking the From: field. I see a method for doing that here:

    By doing it this way I can get away with doing everything over a SSH tunnel to my main computer from my Android device. VX Connectbot apparently supports ssh tunneling so once that and K9Mail (which I haven’t actually installed or looked at yet) are set up on my phone it should just work.

    The reason for handling outbound email this way instead of sending it directly from my phone (or whatever) is that this way I won’t have to worry about sender restrictions on the various mailservers. For example, my own little mail and webserver lives on the 192.168.0.x network in my theatre, and postfix relay is set up to permit_mynetworks only. In addition, I think (though I’m not completely certain) that both of the ISPs that I have service from allow email to be relayed through their mailservers only from a network address that’s one of theirs. I have routing tables set up on my main computer to make sure that outbound email goes out via the appropriate gateway. I won’t have to open up my own mailserver to relay any more than it does now, and the outbound email should continue to work as it does now.

    It appears that I can make this whole mess work over a SSH connection via VX
    Connectbot, so simply forwarding port 22 on my gateway routers to my main computer should buy me everything that I need. Plus that gives me a commandline on my main computer from anywhere, and I can play with VNC on my phone too. I
    don’t know how usable VNC would actually be on such a small screen but I’ll give it a shot one of these days and see what it looks like.

    That’s my scheme so far. Any of you fine folks are very welcome to tell me why it won’t work or suggest a better way to get from Point A to Point B. I’ve never set up anything quite like this before so it’s a figure-it-out-as-I-go procss.

    I’m obviously going to set up some dummy email accounts and experiment with this a bit and get it all up and running before trying to convert my real email and go live with it. I really don’t want to blow up my email; things would become far more interesting that they need to be if something like that happened.

    I think it’ll be pretty cool once it’s up and running, though.

  • Being a mail administrator for both work, and a couple of other sites, the only concern I would have with this is that you need to be fairly careful that the outgoing is routing out a machine that is authorized to send mail for these domains, otherwise, you’ll be looking at a lot of providers blocking your messages as being potential spam fodder and subsequently blacklisting you or the domains in question.

  • That’s why I’m planning to send all outbound email back to my main desktop computer and use the method described at I’m thinking that this method should make any outbound email sent from my phone both look like it came from my desktop computer, and insure that it gets sent to the appropriate mailserver as specified in my From: field.

    Right now I have each account set up in my Sylpheed mail client, so when I want to send an email from, I just select that from the list of available accounts, type my email and hit Send, whereupon the email goes out to the mailserver and is handled from there. I’m thinking that the method described above will allow me to be able to do that from my phone:
    Select an outbound account, type email, hit send. The email goes to my desktop computer which looks at the From: field, decides on the appropriate mailserver based on that, and send the email. Just like it had originated on my desktop computer as it does now.

    At least, that’s my theory. Do you see any holes in that scheme that I’m missing?

  • Ok, but that applies to hardware that you own as well. Maybe you can beat Google for redundancy, reliability, distributed backups, etc. but it won’t be easy. And with a simple imapsync or maybe even some tweaks to your sylpheed setup you could have both. That is, use google for live access but keep a mirror copy. My guess is that your disk(s) will die before googles’. Other ISP type accounts will come and go as you change services.

    But how do you set your From: separately for every message in the android mailer – and it seems awkward when you could be connecting directly to the account in question.

    Again, seems awkward to tunnel access to a private host to access stuff that had just been pulled from publicly reachable accounts.

    Android could reply back through the account directly. Your complications are coming from combining things in the first place.

    Many/most ISP and email hosts allow mobile access with login/password.

    Sure, it will work, but I don’t really see what you gain over just using the services as-is as separate accounts, especially if they all offer IMAP so your computer and phone see the same things. (Plus your archived copy if you want…). I have several accounts myself, but nearly all of them are configured to forward to gmail and I never use them directly.

    I ran something similar using an SME server as the imap host for a long time – before google offered imap service. But now that box is dead and google is still running…

  • I can’t reply directly from my phone because of restrictions on the mailservers. Gmail and friends don’t care, but both of the ISP’s that I have email accounts on allow outbound SMTP only from “their” IP addresses. So if I’m connected to J. Random WIFI, or even the Other Guy’s cellular network, sending email directly to those mailservers for forwarding along ain’t gonna work.

    My desktop computer has routing tables that make sure that email to various mailservers goes out the right gateway so this problem doesn’t exist.

    Some don’t have IMAP at all, and some don’t allow IMAP on “foreign” IP
    addresses. Therefore, I would be stuck with webmail on those particular webservers, which seems really inconvenient and won’t allow me to aggregate all of my email into a single (sorted) pile.

  • It’s not that gmail doesn’t care, it is that they handle authenticated access for sending as part of the account setup. And many/most mail services do too. It’s probably not a good idea to rely on any service where you don’t have mobile access anyway. Or to give out ISP email addresses that will go away when you change services.

    But in the bigger picture, how much do you need those accounts/addresses? And if you continue to use them at all, can you set them to forward to something with more full-featured service?