Notes
main
main
  • Introduction
  • linuxKernel
    • tips
    • make_help
    • old linux
      • compile_linux0.11
      • TestEnvironment
      • load_setup
      • get_hard_data
    • list
    • plist
    • fifo
    • idr
    • xarray
    • rbtree
    • maple_tree
    • syscall
    • bitmap
    • page
    • page_flags
    • page_size
    • page mapcount
    • page refcount
    • folio
    • slub
      • proc_slabinfo
      • slub_theory
      • kmalloc_kfree
      • kmem_cache
      • slab_alloc
      • slab_free
      • proc_meminfo_SReclaimable_SReclaimable
    • vmalloc
    • brk
    • mmap
    • mremap
    • mprotect
    • madvise
    • read
    • write
    • shmem
    • huge_page
    • page_fault
    • rmap
    • lru
    • multi-gen-LRU
    • page_reclaim
    • page_cache
    • page_table
    • rcu
    • kvm
    • aarch64_boot
    • tracing_system
    • cache_coherence_and_memory_consistency
    • cpu_speculates
    • mmap_lock
    • per-vma_lock
    • cgroup
    • symbol
    • campact
    • page_ext
    • mempool
    • kernelstack
    • filesystem
    • io_stack
    • workingset
    • ioremap
    • sched_period
  • linuxDebug
    • openocd_openjtag
    • i2c_tools
    • objdump
    • addr2line
    • gdb_useage
    • debug_linux_kernel_via_gdb
    • debug_linux_module_via_gdb
    • early_boot
    • sequentially_execute
    • dynamic_debug
    • research_linuxKernel_by_patch
    • tracefs
    • ebpf
    • bpftrace
    • perf
    • flame_graph
    • crash
    • ASAN_HWASAN_MTE_check_mem_bug
    • page_owner
    • vmtouch
    • fio
    • benchmark
  • linuxSystem
    • common
      • system_version
      • procfs
      • proc_sys_vm
      • cmd_ps
      • makefile
      • file_descriptor
      • psi
      • ulimit
      • top
      • delay_accounting
    • ubuntu
      • custom_kernel
      • get_cmd_src
      • record_ssh_info
      • log
      • run_custom_script
      • repo
      • cockpit
      • nfs
      • tftp
      • misc
    • fedora
      • system_upgrade
      • custom_kernel
      • lvextend
      • yt-dlp
      • jellyfin
  • linuxDriver
    • i2c_peripherals_driver
    • spi_peripherals_driver
    • gpio_subsystem
    • IRQ_driver
    • blockIO_unblockIO_async
    • linux_own_driver
    • misc_device
    • input_device
    • timer
    • atomic_spinlock_semaphore_mutex
    • lcd
    • touch_screen
    • debugfs
    • v4l2
    • mmap
  • hardware
    • paging_mmu_pt
    • iommu
  • process_thread_scheduler
    • scheduler01
    • scheduler02
    • scheduler03
    • scheduler04
    • scheduler05
    • scheduler06
  • memory_management
    • mm1
    • mm2
    • mm3
    • mm4
    • mm5
  • input_output_filesystem
    • io_fs_01
    • io_fs_02
    • io_fs_03
    • io_fs_04
  • lock_and_lockup_detector
    • general_lock
    • hung_task
    • softLockup_hardLockup
    • crash_experiment
  • MIT_6.S081
    • 6.S081_Operating_System_Engineering
    • Schedule.md
    • Class
      • Overview
      • Administrivia
    • Labs
      • Tools
      • Guidance
      • startup
      • syscall
      • page_table
      • Calling_Convention
      • traps
    • xv6
      • xv6
    • References.md
  • qemu
    • qemu_buildroot
    • qemu_busybox.md
    • Serial.md
    • demo_mini2440
      • 0_compilation_error_summary
      • 1_compilation_steps
      • 2_operation_mode
      • 3_transplant_tools_libraries
      • 4_tools_use
      • reference_website
  • tools
    • getKernelSourceCodeList
    • nat
    • shell
    • translating
    • YouCompleteMe
    • cscope
    • global
    • vscode
    • vim
    • binary
    • markdown
    • draw
    • git
    • tig
    • tmux
    • mail_client
    • download_patchset_from_LKML
    • minicom
    • clash
  • other
    • interview
    • interview_c_base
    • know_dontknow
    • Stop-Ask-Questions-The-Stupid-Ways
    • How-To-Ask-Questions-The-Smart-Way
    • docker
    • buildroot
    • rv32_to_rv64
Powered by GitBook
On this page
  • 简介
  • mutt
  • offlineimap + mutt
  • 未来
  • wget + mutt
  • mutt 颜色配置
  • 参考

Was this helpful?

  1. tools

mail_client

PrevioustmuxNextdownload_patchset_from_LKML

Last updated 2 years ago

Was this helpful?

简介

一个完整的邮件客户端需要包括三大部分:收取邮件、发送邮件、阅读邮件。

  • 收取邮件一般是由 IMAP、POP3 协议来进行

  • 发送邮件是由 SMTP 协议来进行

Linux 邮件客户端有 TUI 或 GUI 类型,其中 TUI 类型比较著名的是 mutt、neomutt 等等, GUI 类型比较著名的是 Thunderbird 等等

我的目的只是单纯想回复 LKML 的某一个邮件,所以选择 mutt

mutt

mutt 收取/发送/阅读邮件

通过执行 $ sudo apt install mutt 来安装 mutt,然后参考 Mutt (TUI) 小节,配置 ~/.muttrc,然后将用户名/密码替换一下,运行 $ mutt 就可以正常使用。

目前在国内使用 gmail,Mutt 读取邮箱的速度太慢了,这是 gmail 被墙的问题,所以需要 将 gmail 邮件下载到本地,这样就不用每次都访问 gmail 读取邮箱,从而使用下面的软件搭配。

offlineimap + mutt

使用 offlineimap 收取邮件,mutt 发送/阅读邮件

通过执行 $ sudo apt install offlineimap 来安装 offlineimap,参考 /usr/share/doc/offlineimap/examples/offlineimap.conf[.minimal] 配置 ~/.offlineimaprc,如下:

[general]
accounts = Gmail

[Account Gmail]
localrepository = Local
remoterepository = Remote

[Repository Local]
type = Maildir
localfolders = ~/Mail

[Repository Remote]
type = IMAP
remotehost = imap.gmail.com
remoteuser = xxx@gmail.com
remotepass = xxx
sslcacertfile = OS-DEFAULT
folderfilter = lambda foldername: foldername in ['INBOX']

配置完成后,通过 $ offlineimap 将 gmail 邮件下载到本地,接着配置 ~/.muttrc 读取 offlineimap 下载到本地的邮件,如下:

# ================  IMAP ====================
set folder = ~/Mail
set spoolfile = "+INBOX"

# ================  SMTP  ====================
set smtp_url = "smtp://xxx@smtp.gmail.com:587/"
set smtp_pass = "xxx"
set ssl_force_tls = yes # Require encrypted connection

# ================  Composition  ====================
set editor = "vi"
set edit_headers = yes  # See the headers when editing
set charset = UTF-8     # value of $LANG; also fallback for send_charset
# Sender, email address, and sign-off line must match
unset use_domain        # because joe@localhost is just embarrassing
set realname = "xxx xxx"
set from = "xxx@gmail.com"
set use_from = yes

# ================  Others  ====================
set sort = threads
set sort_aux = reverse-last-date-received

这时候运行 $ mutt 就可以阅读本地邮件了,以后 gmail 有新邮件时,需要手动执行 $ offlineimap 将新邮件下载到本地。

未来

ubuntu 默认安装 Python2 版本的 offlineimap,官方已经停止维持,最新是 Python3版本 (offlinemap3)

neomutt 是 mutt 的下游产品,添加更多功能

因为刚刚开始,所以准备先用 offlineimap + mutt,后面慢慢优化, 更新到 offlineimap3 + neomutt

wget + mutt

有时候我们想要回复 LKML 的邮件,但是又没有将邮件抄送给我们, 我们要如何回复 LKML 的邮件?

在 LKML 找到对应想要回复的邮件对应的 raw 链接,即 mbox 文件。 然后通过 wget 下载 mbox 文件,导入到 mutt 中

$ wget https://lore.kernel.org/xxx/raw
$ mutt -f raw

此时已经进入到 mutt,能够按照正常操作回复此邮件了

mutt 颜色配置

  • Patch 高亮

# ==============  Patch color  =================
color   body    red             black    "^-.*"
color   body    green           black    "^[+].*"
color   body    brightwhite     black    "^diff --git.*"
color   body    brightwhite     black    "^index [a-f0-9].*"
color   body    brightwhite     black    "^\-\-\- a.*"
color   body    brightwhite     black    "^[\+]{3} b.*"
color   body    brightyellow    black    "^@@.*"
color   body    brightmagenta   black    "^(Signed-off-by).*"
color   body    brightmagenta   black    "^(Reported-by).*"
color   body    brightmagenta   black    "^(Suggested-by).*"
color   body    brightmagenta   black    "^(Acked-by).*"
color   body    brightmagenta   black    "^(Reviewed-by).*"
color   body    brightmagenta   black    "^\-\-\-$"
color   body    white           black    "^( \#define).*"
color   body    white           black    "^( \#include).*"
color   body    white           black    "^( \#if).*"
color   body    white           black    "^( \#el).*"
color   body    white           black    "^( \#endif).*"

color   body    green           black    "LGTM"
color   body    brightmagenta   black    "-- Commit Summary --"
color   body    brightmagenta   black    "-- File Changes --"
color   body    brightmagenta   black    "-- Patch Links --"
color   body    green           black    "^Merged #.*"
color   body    red             black    "^Closed #.*"
color   body    brightblue      black    "^Reply to this email.*"
  • 嵌套引用高亮

# ==============  Quoted Color  =================
set quote_regexp = "^([ \t]*[>])+"

color   quoted  blue            black
color   quoted1 magenta         black
color   quoted2 cyan            black
color   quoted3 yellow          black
color   quoted4 red             black

参考

Email clients info for Linux¶
offlineimap
mutt
Mutt: 阅读邮件列表