All Projects → emersion → Go Imap

emersion / Go Imap

Licence: mit
📥 An IMAP library for clients and servers

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Go Imap

Go Smtp
📤 An SMTP client & server library written in Go
Stars: ✭ 655 (-46.18%)
Mutual labels:  mail, server, client
Meli
🐝 experimental terminal mail client, mirror of https://git.meli.delivery/meli/meli.git https://crates.io/crates/meli
Stars: ✭ 242 (-80.12%)
Mutual labels:  mail, imap, client
James Project
Emails at the heart of your business logic!
Stars: ✭ 485 (-60.15%)
Mutual labels:  mail, server, imap
Clientserverproject
一个C-S模版,该模版由三部分的程序组成,一个服务端运行的程序,一个客户端运行的程序,还有一个公共的组件,实现了基础的账户管理功能,版本控制,软件升级,公告管理,消息群发,共享文件上传下载,批量文件传送功能。具体的操作方法见演示就行。本项目的一个目标是:提供一个基础的中小型系统的C-S框架,客户端有三种模式,无缝集成访问,winform版本,wpf版本,asp.net mvc版本,方便企业进行中小型系统的二次开发和个人学习。同时网络组件方便的支持读写三菱和西门子PLC的数据,详细见Readme
Stars: ✭ 873 (-28.27%)
Mutual labels:  server, client
Node Minecraft Protocol
Parse and serialize minecraft packets, plus authentication and encryption.
Stars: ✭ 697 (-42.73%)
Mutual labels:  server, client
Generator Ng Fullstack
Client, server or fullstack - it's up to you. ng-fullstack gives you the best of the latest.
Stars: ✭ 701 (-42.4%)
Mutual labels:  server, client
Mailcatcher
Catches mail and serves it through a dream.
Stars: ✭ 5,512 (+352.92%)
Mutual labels:  mail, server
Emodbus
Modbus library for both RTU and TCP protocols. Primarily developed on and for ESP32 MCUs.
Stars: ✭ 29 (-97.62%)
Mutual labels:  server, client
Docker Mailserver
Production-ready fullstack but simple mail server (SMTP, IMAP, LDAP, Antispam, Antivirus, etc.) running inside a container.
Stars: ✭ 8,115 (+566.8%)
Mutual labels:  mail, imap
Go Raknet
An idiomatic Go library implementing a basic version of the RakNet protocol.
Stars: ✭ 40 (-96.71%)
Mutual labels:  server, client
Subscriptions Transport Sse
A Server-Side-Events (SSE) client + server for GraphQL subscriptions
Stars: ✭ 55 (-95.48%)
Mutual labels:  server, client
Simple Websocket Server
A very simple, fast, multithreaded, platform independent WebSocket (WS) and WebSocket Secure (WSS) server and client library implemented using C++11, Boost.Asio and OpenSSL. Created to be an easy way to make WebSocket endpoints in C++.
Stars: ✭ 685 (-43.71%)
Mutual labels:  server, client
Vibora
Fast, asynchronous and elegant Python web framework.
Stars: ✭ 5,734 (+371.16%)
Mutual labels:  server, client
Vertx Web
HTTP web applications for Vert.x
Stars: ✭ 853 (-29.91%)
Mutual labels:  server, client
Imapcopy
Recursively copy all e-mail messages and folders from one IMAP account to another.
Stars: ✭ 52 (-95.73%)
Mutual labels:  mail, imap
Hedwig
Send email to any SMTP server like a boss, in Swift and cross-platform
Stars: ✭ 1,096 (-9.94%)
Mutual labels:  mail, server
Zeus
A high performance, cross-platform Internet Communication Engine. Developed with native socket API. Aim at handling millions of concurrent connections.
Stars: ✭ 30 (-97.53%)
Mutual labels:  server, client
Oicq
🐧 一款使用 Java 语言编写的仿 QQ 聊天工具
Stars: ✭ 64 (-94.74%)
Mutual labels:  server, client
Hydroxide
A third-party, open-source ProtonMail CardDAV, IMAP and SMTP bridge
Stars: ✭ 578 (-52.51%)
Mutual labels:  mail, imap
Milo
Eclipse Milo™ - an open source implementation of OPC UA (IEC 62541).
Stars: ✭ 587 (-51.77%)
Mutual labels:  server, client

go-imap

godocs.io builds.sr.ht status Codecov

An IMAP4rev1 library written in Go. It can be used to build a client and/or a server.

Usage

Client godocs.io

package main

import (
	"log"

	"github.com/emersion/go-imap/client"
	"github.com/emersion/go-imap"
)

func main() {
	log.Println("Connecting to server...")

	// Connect to server
	c, err := client.DialTLS("mail.example.org:993", nil)
	if err != nil {
		log.Fatal(err)
	}
	log.Println("Connected")

	// Don't forget to logout
	defer c.Logout()

	// Login
	if err := c.Login("username", "password"); err != nil {
		log.Fatal(err)
	}
	log.Println("Logged in")

	// List mailboxes
	mailboxes := make(chan *imap.MailboxInfo, 10)
	done := make(chan error, 1)
	go func () {
		done <- c.List("", "*", mailboxes)
	}()

	log.Println("Mailboxes:")
	for m := range mailboxes {
		log.Println("* " + m.Name)
	}

	if err := <-done; err != nil {
		log.Fatal(err)
	}

	// Select INBOX
	mbox, err := c.Select("INBOX", false)
	if err != nil {
		log.Fatal(err)
	}
	log.Println("Flags for INBOX:", mbox.Flags)

	// Get the last 4 messages
	from := uint32(1)
	to := mbox.Messages
	if mbox.Messages > 3 {
		// We're using unsigned integers here, only subtract if the result is > 0
		from = mbox.Messages - 3
	}
	seqset := new(imap.SeqSet)
	seqset.AddRange(from, to)

	messages := make(chan *imap.Message, 10)
	done = make(chan error, 1)
	go func() {
		done <- c.Fetch(seqset, []imap.FetchItem{imap.FetchEnvelope}, messages)
	}()

	log.Println("Last 4 messages:")
	for msg := range messages {
		log.Println("* " + msg.Envelope.Subject)
	}

	if err := <-done; err != nil {
		log.Fatal(err)
	}

	log.Println("Done!")
}

Server godocs.io

package main

import (
	"log"

	"github.com/emersion/go-imap/server"
	"github.com/emersion/go-imap/backend/memory"
)

func main() {
	// Create a memory backend
	be := memory.New()

	// Create a new server
	s := server.New(be)
	s.Addr = ":1143"
	// Since we will use this server for testing only, we can allow plain text
	// authentication over unencrypted connections
	s.AllowInsecureAuth = true

	log.Println("Starting IMAP server at localhost:1143")
	if err := s.ListenAndServe(); err != nil {
		log.Fatal(err)
	}
}

You can now use telnet localhost 1143 to manually connect to the server.

Extensions

Support for several IMAP extensions is included in go-imap itself. This includes:

Support for other extensions is provided via separate packages. See below.

Extending go-imap

Extensions

Commands defined in IMAP extensions are available in other packages. See the wiki to learn how to use them.

Server backends

Related projects

  • go-message - parsing and formatting MIME and mail messages
  • go-msgauth - handle DKIM, DMARC and Authentication-Results
  • go-pgpmail - decrypting and encrypting mails with OpenPGP
  • go-sasl - sending and receiving SASL authentications
  • go-smtp - building SMTP clients and servers

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].