3

I'm studying and learning about how mail is handled in linux systems, and one thing has become a source of confusion for me. On my iPhone, via IMAP, I can mark a message in my Gmail inbox as read, or I can move it to another folder ("label" in Gmail speak). Then when I later view my Gmail account via web interface, these changes have percolated to the Gmail server.

However, given my linux client, I have read that all fetchmail does is fetch mail (pun unintended), rather than deliver it. The delivery part would be the responsibility of procmail or postfix.

But if fetchmail just hands off the delivery part to procmail or postfix, it doesn't seem like it would have any way of knowing whether that email was later marked as read or saved to a specific IMAP folder. In fact, it seems like the idea of an "IMAP folder" wouldn't even seem to exist any longer at that point! Does fetchmail actually do some creation or marking of "IMAP folders"?

So is it possible to use fetchmail to get local copies of mail from the server, yet still keep the IMAP features of marking messages as read and moving them to specific folders? If so, how?

1
  • 3
    If you want to keep a local mail folder and your IMAP/Gmail account in sync, you might want to have a look at offlineimap instead May 16, 2011 at 18:26

1 Answer 1

7

No. When you read email via IMAP, the mail stays on the server. The client just downloads individual messages as needed to display them. When you mark it read or move it to a folder, the client just sends a message to the server asking it to do that.

When fetchmail downloads a local copy, what happens to that copy is not reflected on the server side.

If you want the things you do to your mail to be reflected on the server, then you don't want to use fetchmail. You want an IMAP-enabled mail client, of which there are many for Linux. It looks like the only Linux client officially supported by Google is Thunderbird, but other clients are likely to work also.

3
  • 1
    This sounds like fetchmail would keep fetching the same messages over and over. That doesn't seem very useful. Assuming that it doesn't do that, how does it know which messages to fetch?
    – sootsnoot
    Oct 24, 2022 at 18:28
  • 1
    @sootsnoot, it depends on how fetchmail is configured. It has the ability to keep track of which messages have already been downloaded through various methods. Read its documentation or ask a new question.
    – cjm
    Oct 25, 2022 at 15:51
  • Okay, thanks, I'll run some experiments and figure it out. Though with luck, I can abandon this idea and get goformz.com to send a POST request directly to my website, instead of sending email to a bot.
    – sootsnoot
    Oct 26, 2022 at 19:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .