Skip to content

emersion/go-imap-compress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-imap-compress

GoDoc

The IMAP COMPRESS Extension for go-imap

Usage

package main

import (
		"log"

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

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)
	}

	// Enable compression if possible
	comp := compress.NewClient(c)
	if ok, err := comp.SupportCompress(compress.Deflate); err != nil {
		log.Fatal(err)
	} else if ok {
		if err := comp.Compress(compress.Deflate); err != nil {
			log.Fatal(err)
		} else {
			log.Printf("Compression enabled: %t", comp.IsCompress())
		}
	}

	// Continue using c with compression enabled
}

License

MIT

About

The IMAP COMPRESS Extension for go-imap

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages