go-imap-client

command module
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2022 License: MIT Imports: 1 Imported by: 0

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 🚀.

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.

Flag Short Description Example Default
--config Specify a config file to use. See configuration for more details. --config my-config.yaml" Searches for a config in various places. See configuration.
--server -s The IMAP server to connect against. Including its port. --server "imap.google.com:993"
--username -u The username used to authenticate. --username "[email protected]"
--password -p The password of the user. Use single quotes ' to wrap passwords with special characters. --password 'password'
--tls Set to connect against servers using TLS. (required for most mail servers) --tls false
--skip-verify When using --tls can be used to disable the certificate check. Should only be used for testing! --skip-verify false
--timeout Set a timeout for connecting to the mail server. --timeout 10s 5s

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

Flag Short Description Example Default
--mailbox -m Set the mailbox/folder to search. --mailbox Archive INBOX
--no-results-error -e Returns an error and exit code if the search finds no results. --no-results-error false
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

Documentation

Overview

Copyright © 2022 Michael Reichenbach

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL