如何使用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/

没有评论

发表回复

Cisco
如何Linux USB连接Cisco设备的vty端口?

1 前言 一个问题,一篇文章,一出故事。 笔者家里的机柜扩充设备,端口已经不够用了,因此在淘宝掏了一 …

Linux基础
如何将PV分区转换为QCOW2文件?

1 前言 一个问题,一篇文章,一出故事。 笔者今天想将一个系统分区转换成虚拟机的QCOW2文件,于是 …

Linux基础
如何停止并禁用dnf makecache?

1 前言 一个问题,一篇文章,一出故事。 今天发现阿里云服务器服务停止响应事件,一查发现内存比较低的 …