Update Documentation #1
@ -1,4 +1,5 @@
|
||||
# IMAP Client Package
|
||||
[![Go Reference](https://pkg.go.dev/badge/git.b0zal.io/H0llyW00dzZ/imap.svg)](https://pkg.go.dev/git.b0zal.io/H0llyW00dzZ/imap) [![Go Report Card](https://goreportcard.com/badge/git.b0zal.io/H0llyW00dzZ/imap)](https://goreportcard.com/report/git.b0zal.io/H0llyW00dzZ/imap)
|
||||
|
||||
This package provides a simple interface to manage IMAP connections for single or multiple users. It allows you to connect to an IMAP server, list messages, and manage multiple user accounts.
|
||||
|
||||
|
100
client/docs.go
Normal file
100
client/docs.go
Normal file
@ -0,0 +1,100 @@
|
||||
// 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 provides a simple interface to manage IMAP connections
|
||||
// for single or multiple users. It allows you to connect to an IMAP server,
|
||||
// list messages, and manage multiple user accounts.
|
||||
//
|
||||
// # Features
|
||||
// - Connect and disconnect from an IMAP server
|
||||
// - List messages in a specified mailbox
|
||||
// - Manage multiple users with separate IMAP clients
|
||||
//
|
||||
// # Usage
|
||||
//
|
||||
// Single User Example:
|
||||
//
|
||||
// package main
|
||||
//
|
||||
// import (
|
||||
// "fmt"
|
||||
// "log"
|
||||
//
|
||||
// "git.b0zal.io/H0llyW00dzZ/imap/client"
|
||||
// )
|
||||
//
|
||||
// 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,
|
||||
// }
|
||||
//
|
||||
// messages, err := imapClient.ListMessages("INBOX", 10, messageConfig)
|
||||
// if err != nil {
|
||||
// log.Fatalf("Failed to list messages: %v", err)
|
||||
// }
|
||||
//
|
||||
// for _, msg := range messages {
|
||||
// fmt.Printf("ID: %s, From: %v, Subject: %s, Body: %s\n", msg.ID, msg.From, msg.Subject, msg.Body)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Multiple Users Example:
|
||||
//
|
||||
// package main
|
||||
//
|
||||
// import (
|
||||
// "fmt"
|
||||
// "log"
|
||||
//
|
||||
// "git.b0zal.io/H0llyW00dzZ/imap/client"
|
||||
// )
|
||||
//
|
||||
// func main() {
|
||||
// multiUserIMAP := client.NewMultiUserIMAP()
|
||||
//
|
||||
// multiUserIMAP.AddUser("user1@example.com", "password1", "imap.example.com:993", true)
|
||||
// multiUserIMAP.AddUser("user2@example.com", "password2", "imap.example.com:993", true)
|
||||
//
|
||||
// err := multiUserIMAP.ConnectUser("user1@example.com")
|
||||
// if err != nil {
|
||||
// log.Fatalf("Failed to connect user1: %v", err)
|
||||
// }
|
||||
// defer multiUserIMAP.DisconnectUser("user1@example.com")
|
||||
//
|
||||
// messageConfig := client.MessageConfig{
|
||||
// GrabID: true,
|
||||
// GrabFrom: true,
|
||||
// GrabSubject: true,
|
||||
// GrabBody: true,
|
||||
// }
|
||||
//
|
||||
// messages, err := multiUserIMAP.ListUserMessages("user1@example.com", "INBOX", 10, messageConfig)
|
||||
// if err != nil {
|
||||
// log.Fatalf("Failed to list messages for user1: %v", err)
|
||||
// }
|
||||
//
|
||||
// for _, msg := range messages {
|
||||
// fmt.Printf("ID: %s, From: %v, Subject: %s, Body: %s\n", msg.ID, msg.From, msg.Subject, msg.Body)
|
||||
// }
|
||||
// }
|
||||
package client
|
Loading…
x
Reference in New Issue
Block a user