Documentation
¶
Overview ¶
Package export provides functionality to export email messages in various formats. It defines interfaces and implementations for exporting messages, allowing flexibility in how messages are written to different outputs.
Features ¶
- Define a standard interface for exporting messages
- Implement JSON export functionality with customizable encoding
Usage ¶
JSON Export Example:
package main import ( "log" "os" "git.b0zal.io/H0llyW00dzZ/imap/client" "git.b0zal.io/H0llyW00dzZ/imap/export" ) func main() { config := &client.Config{ Username: "user@example.com", Password: "password", Server: "imap.example.com:993", InsecureSkipVerify: true, } imapClient := client.NewIMAP(config) err := imapClient.Connect() if err != nil { log.Fatalf("Failed to connect: %v", err) } defer imapClient.Disconnect() messageConfig := client.MessageConfig{ GrabID: true, GrabFrom: true, GrabSubject: true, GrabBody: true, } file, err := os.Create("messages.json") if err != nil { log.Fatalf("Failed to create file: %v", err) } defer file.Close() exporter := &export.JSONExporter{Encoder: export.DefaultJSONEncoder} err = imapClient.ExportMessagesTo(file, exporter, "INBOX", 10, messageConfig) if err != nil { log.Fatalf("Failed to export messages: %v", err) } }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type JSONEncoderFunc ¶
JSONEncoderFunc defines a function type for custom JSON encoding
type JSONExporter ¶
type JSONExporter struct {
Encoder JSONEncoderFunc
}
JSONExporter implements the Exporter interface for JSON with a custom encoder
Click to show internal directories.
Click to hide internal directories.