imapclient/id.go

go-imap · imapclient/id.go · go · MIT
email

Implements IMAP ID command handling and parsing for client communication.

// 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 imapclient

import (
	"fmt"

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

// ID sends an ID command.
//
// The ID command is introduced in RFC 2971. It requires support for the ID
// extension.
//
// An example ID command:
//
//	ID ("name" "go-imap" "version" "1.0" "os" "Linux" "os-version" "7.9.4" "vendor" "Yahoo")
func (c *Client) ID(idData *imap.IDData) *IDCommand {
	cmd := &IDCommand{}
	enc := c.beginCommand("ID", cmd)

	if idData == nil {
		enc.SP().NIL()
		enc.end()
		return cmd
	}

	enc.SP().Special('(')
	isFirstKey := true
	if idData.Name != "" {
		addIDKeyValue(enc, &i

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

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

Get a free API key