maildir

Extract only the body part of incoming emails using bash

不想你离开。 提交于 2019-12-24 00:25:24
问题 I use offlineimap to fetch the mails into a Maildir folder. I want to automatically parse all new incoming emails in a Maildir folder and send only the "from", "subject" and "body" as an instant message somewhere else. So I try to process all mails with MPATH=~/Mail if [ -n "$(ls "$MPATH/INBOX/new/")" ]; then for f in "$MPATH/INBOX/new/"*; do SUB="$(cat "$f"|grep '^Subject' | head -n1 | sed "s/Subject: //g")" FROM="$(cat "$f" | grep '^From' | head -n1 | head -n 1|sed "s/From: //g")" BODY="$

Issue processing MailDir format with Java on Windows

空扰寡人 提交于 2019-12-24 00:01:29
问题 This is really two questions, but they are very closely related. I am developing a Java application that will process emails stored in the UNIX style MailDir format. I am using the JavaMail API, and found JavaMailDir that should work as a provider capable of reading the format my email will be in. The issue I am running into is that JavaMailDir seems to always expect your mail folder (the one passed into store.getFolder() ) to begin with a dot. I only have access to a Windows machine for my

maildir headers problem

折月煮酒 提交于 2019-12-11 06:05:53
问题 I have the followign bash script to update mtimes for maildir files: #!/bin/bash for i in /test/emailfile do date=$(sed -n '/Received: from/ { :a; n; /;/ {s/.*; //p;q}; b a }' "$i") newdate=$(date -d "$date" +'%Y%m%d%H%M.%S') touch -t "$newdate" "$i" done This script has always worked fine, with standard headers like these: Delivery-date: Sun, 22 Apr 2007 00:15:13 -0600 Received: from an-out-0708.google.com ([209.85.132.243]) by x.xxxx.com with esmtp (Exim 4.63) (envelope-from <xxxxxx@gmail

Convert Maildir to mbox

北城以北 提交于 2019-12-03 05:19:58
问题 Im changing hosts and i need to convert my maildir accounts on my old server to mbox on my new server. Any ideas on the best way to do this? I found this: for i in new/* cur/*;do formail <”$i” >> ../mbox;done But i dont really understand it. I have a basic knowledge of linux and I have root access to my server via ssh. most of the Maildir folder have the following contents: cur new tmp dovecot.index.log dovecot-uidlist dovecot.index dovecot.index.log.2 dovecot.index.cache dovecot-keywords