Categorygithub.com/Silthus/go-imap-client
modulepackage
1.2.2
Repository: https://github.com/silthus/go-imap-client.git
Documentation: pkg.go.dev

# README

go-imap-client

A command line client implementing the go-imap library to search IMAP mailboxes.

Installation

Download the binary for your operating system from the releases page, and you are done :rocket:.

Usage

You can always find the up-to-date and full help by running go-imap-client -h. Here is a list of possible flags and their options.

FlagShortDescriptionExampleDefault
--configSpecify a config file to use. See configuration for more details.--config my-config.yaml"Searches for a config in various places. See configuration.
--server-sThe IMAP server to connect against. Including its port.--server "imap.google.com:993"
--username-uThe username used to authenticate.--username "[email protected]"
--password-pThe password of the user. Use single quotes ' to wrap passwords with special characters.--password 'password'
--tlsSet to connect against servers using TLS. (required for most mail servers)--tlsfalse
--skip-verifyWhen using --tls can be used to disable the certificate check. Should only be used for testing!--skip-verifyfalse
--timeoutSet a timeout for connecting to the mail server.--timeout 10s5s

Search

Search the inbox of a mailbox for mails matching a given subject. Here are the search specific flags.

FlagShortDescriptionExampleDefault
--mailbox-mSet the mailbox/folder to search.--mailbox ArchiveINBOX
--no-results-error-eReturns an error and exit code if the search finds no results.--no-results-errorfalse
go-imap-client --server "imap.google.com:993" --tls --username "[email protected]" --password 'my_super_secret_PW!' search awesome search term

Configuration

All parameters can also be configured using a YAML configuration or environment variables prefixed with IMAP_CLI_.
The environment variable keys are all UPPERCASE and dashes are replaced with _ (underscores). For example no-results-error becomes IMAP_CLI_NO_RESULTS_ERROR=true and username is IMAP_CLI_USERNAME=username.

The configuration looks like this. All values can be overwritten by specifying the command line argument. Config files named .go-imap-client.yaml located in $HOME or the executables' directory are sourced automatically.

server: "imap.google.com:993"
tls: true
skip-verify: false
username: [email protected]
password: 'mycomplex!"#pas''sword' # The password is (note the escaped single quote): mycomplex!"#pas'sword
timeout: 10s

no-results-error: true
mailbox: INBOX

# Packages

No description provided by the author
No description provided by the author