IMAP emulator for ratwext.club

*This post was moved from http://rawtext.club where it was originally posted.

Mon Nov 8 10:52:13 PM CET 2021*

Sat 28 Dec 2019 04:13:46 PM UTC

Hello. I find it very convenient to access all my e-mail addresses using one single instance of one single email client. I have 15 addresses and I use mutt. Rawtext makes me ssh into it so I can read my mail. Not anymore. I am taking advantage of other feature I don’t really like, namely using gpg keys to ssh into remote machines. I prefer to remember and type passwords everytime I log on to a remote ssh account. But that’s me.

This is a rather silly but functional emulator of some IMAP functionality. This is a one-liner, and for me it works in BASH:


ssh username@rawtext.club "cd /home/username/Maildir/cur; tar -zcf mail-cur.tar.gz *; cd /home/username/Maildir/new; tar -zcf mail-new.tar.gz *"; scp username@rawtext.club:/home/username/Maildir/cur/mail-cur.tar.gz /home/username/Maildir/cur/; scp username@rawtext.club:/home/username/Maildir/new/mail-new.tar.gz /home/username/Maildir/new/; cd /home/username/Maildir/cur/; tar -zxf mail-cur.tar.gz; rm mail-cur.tar.gz; cd /home/username/Maildir/new/; tar -zxf mail-new.tar.gz; rm mail-new.tar.gz; ssh username@rawtext.club "rm /home/username/Maildir/cur/mail-cur.tar.gz; rm /home/username/Maildir/new/mail-new.tar.gz"

Just replace username with your username. Mind the match, you may have a different username at your local machine than at rawtext.

You can easily make a bash script and invoke that line from a command prompt.

You can put that as a cronjob. I think this is what I will do.

If you use mutt, you can invoke that one-liner, actually any BASH command, by keybinding it on you .muttrc file, like so:


macro index gt '<shell-escape>bashcommandhere<enter>

Source that file, then when you press gt (that is, g then t), that line will be executed. My one-liner spits out ugly output since tar complains a lot about anything, and scp outputs stuff as well, so it is not elegant. I think I will use it with crontab.

You can use mutt and not invoke this through a keybind. Just run the one-liner, or the script if you made it into one, then fire up your mutt, and have fun.

Go back to the main page.