imap/client/config.go

50 lines
1.2 KiB
Go
Raw Permalink Normal View History

// Copyright (c) 2025 H0llyW00dzZ All rights reserved.
//
// By accessing or using this software, you agree to be bound by the terms
// of the License Agreement, which you can find at LICENSE files.
package client
import (
"errors"
"github.com/emersion/go-imap/client"
)
// Config holds the configuration for the IMAP client
type Config struct {
Username string
Password string
Server string
InsecureSkipVerify bool
}
// MessageConfig defines what parts of the message to retrieve
type MessageConfig struct {
GrabID bool
GrabFrom bool
GrabSubject bool
GrabBody bool
GrabSender bool
GrabReplyTo bool
GrabTo bool
GrabCc bool
GrabBcc bool
GrabInReplyTo bool
GrabDate bool
}
// IMAPClient represents an IMAP client
type IMAPClient struct {
config *Config
client *client.Client
}
var (
// ErrorsClientIsNotConnected is returned when an operation is attempted on a client that is not connected.
ErrorsClientIsNotConnected = errors.New("client is not connected")
// ErrorsFailedToReadBody is returned when there is a failure in reading the body of a message.
ErrorsFailedToReadBody = errors.New("failed to read body")
)