如何使用imap-cli?

Linux基础

1 基础知识

1.1 imap-cli的简介

imap-cli允许用户使用命令行或接口与邮件服务器通过imap协议通讯。

1.2 imap-cli的功能

– 获取imap账号的状态(新邮件、邮件数量等)
– 获取INBOX(或其他目录)的邮件列表
– 邮件搜索
– 阅读邮件
– 标记邮件(已读、未读、删除等)
– 复制、移动和删除邮件
– 使用SASL进行身份验证

2 最佳实践

2.1 环境信息

2.1.1 系统环境信息

ip address = 10.168.0.9
host name = imap-cli.cmdschool.org
OS = CentOS 7.x x86_64

2.1.2 安装常用工具

yum install -y vim

2.2 软件配置

2.2.1 安装Python包管理软件

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py

2.2.2 安装imap-cli软件包

pip install imap-cli

注:其他安装方式请参阅如下链接,
https://imap-cli.readthedocs.io/en/latest/installation.html

2.3 配置imap-cli

mkdir -p ~/.config/
vim ~/.config/imap-cli

加入如下配置,

[imap]
hostname = imap.cmdschool.org
username = will@cmdschool.org
password = will_secret
ssl = True

2.4 使用imap-cli

2.4.1 查看程序的版本

imapcli --version

2.4.2 获取帮助

imapcli -h

可见如下提示,

Imap-CLI.

Usage: imapcli [options]  [...]

Available commands are:
    status      List unseen, recent and total number of mail per directory in IM                                                                              AP account
    list        List mail within a specified directory
    search      Search for mail
    read        Display Header and Body of specified mail(s)
    flag        Set or unset flag on specified mail(s)
    copy        Copy (or move) mail from one mailbox to another
    delete      Remove mails (or move to Trash mailbox by default)


Options:
    -h, --help              Show help options
    --version               Print program version

See 'imapcli help ' to get further information about specified command

参阅文档
====================

演示文档
——————–
https://imap-cli.readthedocs.io/en/latest/

imap-cli of github
——————-
https://github.com/Gentux/imap-cli

pip的安装
——————-
https://pip.pypa.io/en/stable/installing/

没有评论

发表回复

Linux基础
如何安装配置Cockpit服务?

1 基础知识 1.1 Cockpit的简介 – Cockpit是基于Web的服务器图形界 …

Linux基础
如何安装部署WebMin?

1 基础知识 2.1 软件简介 – Webmin是基于Web的系统管理工具 &#8211 …

Bash
如何自动锁定非活跃的FTP用户?

1 前言 一个问题,一篇文章,一出故事。 笔者生产环境有台老旧的FTP服务器,用户众多。由于此服务器 …