handleFetch (imapserver/fetch.go)

go-imap · imapserver/fetch.go · go · MIT
email

Handles IMAP FETCH command parsing and response generation for a server.

// Source: https://github.com/emersion/go-imap | License: MIT | Copyright 2013 The Go-IMAP Authors
// Provided via justclaw.it.com; keep this notice with the code.
package imapserver

import (
	"fmt"
	"io"
	"mime"
	"sort"
	"strings"
	"time"

	"github.com/emersion/go-imap/v2"
	"github.com/emersion/go-imap/v2/internal"
	"github.com/emersion/go-imap/v2/internal/imapwire"
)

const envelopeDateLayout = "Mon, 02 Jan 2006 15:04:05 -0700"

type fetchWriterOptions struct {
	bodyStructure struct {
		extended    bool // BODYSTRUCTURE
		nonExtended bool // BODY
	}
	obsolete map[*imap.FetchItemBodySection]string
}

func (c *Conn) handleFetch(dec *imapwire.Decoder, numKind NumKind) error {
	var numSet imap.NumSet
	if !dec.ExpectSP() || !dec.ExpectNumSet(numKind.wire(), &numSet) || !dec.ExpectSP() {
		re

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key