emailをバックアップしたり
$ dpkg -l getmail|tail -1 ii getmail 5.13-1 all mail retriever with support for POP3, IMAP4 and SDPS
$ mkdir -m 700 ~/.getmail $ mkdir -p ~/getmail/mail/cur $ mkdir -p ~/getmail/mail/new $ mkdir -p ~/getmail/mail/tmp
$ vi ~/.getmail/getmailrc
gmailでの例
[retriever] type = SimpleIMAPSSLRetriever server = imap.gmail.com #mailboxes = ("Inbox", "[Gmail]/Sent Mail") # optional - leave this line out to just grab inbox username = USER password = PASS [destination] type = Maildir path = ~/getmail/mail/ [options] verbose = 1 message_log = ~/.getmail/log # retrieve only new messages # if set to true it will re-download ALL messages every time! read_all = false # do not alter messages delivered_to = false received = false
gmailのアプリパスワードはこのページから取得 https://myaccount.google.com/apppasswords
$ getmail
$ crontab -l|grep getmail 3 2 * * * getmail --quiet --new --dont-delete
IMAP4 は有料なのでpop3 を使う
~/.getmail/nifty.rc
として設定を作成
[retriever] #type = SimplePOP3SSLRetriever type = BrokenUIDLPOP3SSLRetriever server = pop.nifty.com #port 995 username = <USERNAME> password = <PASSWORD> use_apop = true [option] delete = false [destination] type = Maildir path = ~/Maildir/nifty/
※ delete = false
は既定値だが一応設定
dir 作成
$ mkdir -p ~/Maildir/nifty/cur $ mkdir -p ~/Maildir/nifty/new $ mkdir -p ~/Maildir/nifty/tmp
$ getmail getmail version 6.18.11 Copyright (C) 1998-2023 Charles Cazabon and others. Licensed under GNU GPL version 2. BrokenUIDLPOP3SSLRetriever:CQA22262@pop.nifty.com:995: read_all and not delete -- all messages will be retrieved each time getmail is run BrokenUIDLPOP3SSLRetriever:CQA22262@pop.nifty.com:995: msg 1/438209 (2322 bytes) delivered msg 2/438209 (1987 bytes) delivered msg 3/438209 (1464 bytes) delivered :
path
の最後が /
じゃないので怒られている
o : ~/Maildir/nifty/
x : ~/Maildir/nifty
Configuration error: configuration file /home/matoken/.getmail/nifty.rc incorrect (path: maildir subdirectory "/home/matoken/Maildir/nifty/cur" does not exist) Configuration error: configuration file /home/matoken/.getmail/nifty.rc incorrect (path: maildir subdirectory "/home/matoken/Maildir/nifty/new" does not exist) Configuration error: configuration file /home/matoken/.getmail/nifty.rc incorrect (path: maildir subdirectory "/home/matoken/Maildir/nifty/tmp" does not exist)
ディレクトリを生成する
$ mkdir -p ~/Maildir/nifty/cur $ mkdir -p ~/Maildir/nifty/new $ mkdir -p ~/Maildir/nifty/tmp
UIDL
未サポートなサーバなので type = SimplePOP3SSLRetriever
ではなく type = BrokenUIDLPOP3SSLRetriever
を使う
コメント