{"id":778,"date":"2026-06-14T20:39:35","date_gmt":"2026-06-14T18:39:35","guid":{"rendered":"https:\/\/www.dont-panic.cc\/capi\/?p=778"},"modified":"2026-06-14T21:22:29","modified_gmt":"2026-06-14T19:22:29","slug":"replacing-gmails-pop3-import-with-go-imapproc","status":"publish","type":"post","link":"https:\/\/www.dont-panic.cc\/capi\/2026\/06\/14\/replacing-gmails-pop3-import-with-go-imapproc\/","title":{"rendered":"Replacing Gmail&#8217;s POP3 import with go-imapproc"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">For years, I have been using Gmail&#8217;s &#8220;Check mail from other accounts&#8221; feature to pull in e-mails from my GMX address and my personal mail server into my Gmail inbox. Simple, reliable, and totally invisible once set up. In the times of SPF, DMARC, and what-not-else, simply forwarding e-mails to another address is just not really reliable any more.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then came the e-mail from Google. <a href=\"https:\/\/support.google.com\/mail\/answer\/16604719\">Google is deprecating the POP3 import feature in Gmail<\/a>. New users can no longer set it up as of early 2026, and existing users will lose it later in the year. The suggested alternatives are either to configure automatic forwarding on the source account (which requires the source provider to support it and, as mentioned, does not work too reliably due to various anti-SPAM techniques) or to add the account in the Gmail mobile app &#8211; which helps exactly nobody who reads their e-mail on a desktop. Also it doesn&#8217;t give you the &#8220;search everything in one place&#8221; benefit.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So I needed a replacement. The idea was to connect to IMAP and use Gmails Import-API to get the mail into Gmail. So I wrote <a href=\"https:\/\/github.com\/capi\/go-imapproc\"><strong>go-imapproc<\/strong><\/a>, a small Go daemon that connects to an IMAP mailbox and processes each unread message by piping it to an external program. When the program exits successfully, the message is marked as read (or deleted, or moved).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8220;external program&#8221; in my case is a Python script bundled with the project (<code>gws-import-to-gmail-direct.py<\/code>) that takes the raw e-mail from stdin and imports it directly into Gmail via the Gmail REST API, using OAuth2 credentials managed by the <a href=\"https:\/\/github.com\/googleworkspace\/cli\">Google Workspace CLI<\/a>. This applies all the standard Google Spam filtering, which is quite good.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An additional upside: instead of polling on a timer, go-imapproc uses IMAP IDLE. The connection stays open and the server pushes a notification the moment a new message arrives. In practice, mail now shows up in my Gmail inbox within seconds of being delivered to my other inboxes &#8211; not within the next hour as it did due to Gmails 60 minute poll interval.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/github.com\/capi\/go-imapproc\"><strong>go-imapproc<\/strong><\/a> is open source and available on GitHub under the <a href=\"https:\/\/github.com\/capi\/go-imapproc\/blob\/main\/LICENSE\">MIT license<\/a>. The project includes the helper scripts for Gmail import, a built-in health endpoint, and a Docker setup if you prefer to run it containerized (as I always do).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><span style=\"text-decoration: underline;\">Disclaimer:<\/span> I used this project as an opportunity to gain more hands-on experience with AI-assisted development. The code-base is not &#8220;vibe coded&#8221; in the dismissive sense of the term, though. Significant effort went into unit and integration tests, following sound engineering principles, and making sure I actually understood and stood behind every piece of code that ended up in the repository. The AI was a tool, not a substitute for engineering judgment. All commits made by AI agents are clearly marked as such in the commit history.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The project has now been importing all my personal mails from several source-accounts for about 2-3 months now, all without any issues. I hope it will be usable to others as well.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">P.S.: Importing to Gmail is just one use-case. There is a lot more you can script based on processing new incoming e-mails when they arrive.<br \/><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>For years, I have been using Gmail&#8217;s &#8220;Check mail from other accounts&#8221; feature to pull in e-mails from my GMX address and my personal mail server into my Gmail inbox. Simple, reliable, and totally invisible once set up. In the times of SPF, DMARC, and what-not-else, simply forwarding e-mails to another address is just not &hellip; <a href=\"https:\/\/www.dont-panic.cc\/capi\/2026\/06\/14\/replacing-gmails-pop3-import-with-go-imapproc\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Replacing Gmail&#8217;s POP3 import with go-imapproc&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,4,10],"tags":[225,117,259,263,260],"class_list":["post-778","post","type-post","status-publish","format-standard","hentry","category-computer","category-development","category-sysadmin","tag-development","tag-email","tag-github","tag-go-imapproc","tag-project"],"_links":{"self":[{"href":"https:\/\/www.dont-panic.cc\/capi\/wp-json\/wp\/v2\/posts\/778","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dont-panic.cc\/capi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dont-panic.cc\/capi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dont-panic.cc\/capi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dont-panic.cc\/capi\/wp-json\/wp\/v2\/comments?post=778"}],"version-history":[{"count":1,"href":"https:\/\/www.dont-panic.cc\/capi\/wp-json\/wp\/v2\/posts\/778\/revisions"}],"predecessor-version":[{"id":779,"href":"https:\/\/www.dont-panic.cc\/capi\/wp-json\/wp\/v2\/posts\/778\/revisions\/779"}],"wp:attachment":[{"href":"https:\/\/www.dont-panic.cc\/capi\/wp-json\/wp\/v2\/media?parent=778"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dont-panic.cc\/capi\/wp-json\/wp\/v2\/categories?post=778"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dont-panic.cc\/capi\/wp-json\/wp\/v2\/tags?post=778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}