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

没有评论

发表回复

cmd shell
如何忽略PowerShell错误邮件地址?

1 前言 一个问题,一篇文章,一出故事。 笔者使用PowerShell发送邮件时,由于收件人列表包含 …

Linux基础
如何解决KDC不支持加密类型问题?

1 前言 一个问题,一篇文章,一出故事。 笔者最近发现生产环境的sftp域用户登录异常,查看sssd …

Linux基础
如何允许应用倾听低于1000的系统端口?

1 前言 一个问题,一篇文章,一出故事。 笔者集群运行logstash发现它希望在514端口倾听,但 …