Git Product home page Git Product logo

mop3's Introduction

MOP3

A Mastodon to email client Gateway

MOP3 is a toy-ish, standards complient-ish server that speaks POP3/SMTP which serves data from your home Mastodon timeline. This enables email clients from as early as the 1980s and as recent as today to receive, send, and reply to Mastodon posts (including images). This was started as a retro-computing project, however I've used it as my main client during development, as even modern email clients like Apple's Mail.app and Windows Mail support POP3 and SMTP. MOP3 can be configured to encode posts in Unicode or ASCII, with or without HTML, and images either as links, or attachments.

Outlook Express displaying Mastodon posts

Sylpheed on Linux

Installation

Binaries are available for Windows, Mac, and Linux on the releases page. This is written in Rust, so running cargo install mop3 on your host should install it. If not, downloading the repo and running cargo build should also work.

Usage

This requires an access token, which can be obtained in Preferences -> Development -> New Application on your Mastodon account. The client key and secret are not required.

mop3 --help will give you all of the important runtime flags. None are required, but --token is reccomended to avoid sending your access token over TCP, and required for posting since SMTP authentication is not implemented. I reccomend the --ascii flag for retro clients, and --html --inline for modern clients.

To connect to it, point your client at the server ip/port, set the username to "[email protected]", the password to your account token, and disable SSL/TLS/SPA/SMTP authentication. If --token is used, the password can be anything. Some clients will not include the domain name in the username by default, so make sure it includes both parts, and use --account if all else fails.

I strongly reccomend turning OFF "Include Original Message"/"Inline reply" and similar settings in your client, as it is very difficult to parse when the reply ends and the original message starts, and the parsing code will often post headers in your mastodon message by mistake.

On the first connection, MOP3 will fetch the last 40 posts on your timeline. On every subsequent connection, it will only fetch the posts that have been uploaded since the last connection. This can't differentiate between clients, so the server will need to be restarted to refetch posts on a new client. Mail.app displaying Mastodon posts

Disclaimer

You run this application at your own risk. MOP3 is my first Rust application, and so probably contains code slightly below world class levels. It is also speaking a protocol from the 90s/70s, with no security, and little authentication. I don't reccomend running this on the internet. I also tried to be friendly with my use of the Mastodon API, but I'm not responsible for any DMs from your sysop if it does something weird. However, the code is relatively simple, it's been tested, and especially with the --token option, not passing around secret data, so it should be perfectly safe to run on a LAN.

mop3's People

Contributors

miakizz avatar wezm avatar julienxx avatar

Stargazers

Mark Malstrom avatar Sunny avatar Omar Rizwan avatar  avatar  avatar Patrick avatar  avatar  avatar Scott Small avatar Dan Poirier avatar  avatar  avatar Konrad Hinsen avatar  avatar æstrid avatar Enno avatar attero avatar Jason Morley avatar Tim Peters avatar Luca avatar Andrés Ignacio Torres avatar masukomi (a.k.a. Kay Rhodes) avatar Ben Arblaster avatar  avatar luna avatar Jan Jastrow avatar Scarlet Tobar avatar Cory avatar Jordan Webb avatar Ricardo avatar Matthias Weiß avatar Crafti avatar  avatar leah avatar  avatar Sqaaakoi avatar Emma avatar Kostiantyn Kukhtinov avatar  avatar  avatar Seshan Ravikumar avatar Markus Kitsinger avatar Morton Fox avatar Tony Bark avatar codepoet avatar Cais avatar Johan Wärlander avatar  avatar Edgar avatar tobozo avatar Chris Houhoulis avatar Guillaume Dumoulin avatar Erlend Sogge Heggen avatar Rafael Carício avatar David Sullivan avatar Fabian Vilers avatar Paul Young avatar Steve Downing avatar Leo avatar  avatar Andy Piper avatar boouqn avatar Morgan Aldridge avatar  avatar Glenn Y. Rolland avatar Justin Alan Ryan avatar Nikolas Evers avatar Lunaphied avatar Grant Hutchinson avatar S. Rey-Coyrehourcq avatar 听风 avatar Matt avatar Geoff Oliver avatar Marius Kießling avatar jmcb avatar  avatar Xander Wardell avatar  avatar Daniel King avatar Karpour avatar dusk avatar Nick Vella avatar Joshua Barretto avatar Christian Korneck avatar Poren Chiang avatar Corentin Bettiol avatar Grzegorz Antoniak avatar Alex N avatar Yue Wu avatar ᚛ᚓᚑᚌᚐᚅ᚜ avatar Larkin avatar Gonzalo Arreche avatar wolfi3 avatar antx avatar Bruno Philipe avatar  avatar Daniel H avatar Adam R. Nelson avatar Camilo avatar hrqmonteiro avatar

Watchers

Aslak Raanes avatar Ellie avatar Wossen Wyatt avatar  avatar  avatar

mop3's Issues

Avatars -> `X-Face`-header

Add avatars as X-Face.

I don't think there are any compface(1) implementation in Rust (yet). Traditionally made by piping trough netpbm etc. and compface as shown in this online X-Face converter https://www.dairiki.org/xface/ i.e. somthing like:

echo  "X-Face:$( curl -s $( curl -s https://mastodon.social/api/v1/accounts/1 | jq  -r .avatar ) | \
  djpeg -grayscale | \
  pnmscale -width 48 -height 48 | \
  pnmpad --width 48 --height 48 | \
  pnmhisteq | \
  pgmtopbm -fs | \
  pbmtoxbm | compface )"

results in:

X-Face: :Iq]CkX#J|O5E1ZdT>HTzV2'xpv#w:gh$UMHa_5AS<Lc`=qX~4m?^xTtZIv5m?@@r3vR$70
 hR/1]kI$+w@xoXm$u"kz1YyLDMz:`F{{$&.]3zXEEUge%VH$pQc87i7NS:A3QhE_c&qO=Nj`QhEo(K
 {ds:/"(ZU\Arw^P}jFea5BGY,;G?9WPZ|%b*L"<4brSH}ruF&[*X6y=tZPP=}&Cn/6;[oK;Ynl#kxk
 *SZa58&y3UDEf'%%N.r''u.R9:aDs1*5I("j2Wp?}$~K(<y:EexbX?0h%uDg3E{zmSmdmAcZ#^pqxN
 KKdAK{%vRcFow6co2d2^

Maybe have an avatar directory of pre-generated files with filenames from hashes of account or avatar-urls?

Pure ascii

Some clients doesn't support unicode well, or at least only partly.

Initially I tought that conversion to ISO-8859-1 (Latin 1) or ISO-8859-15 etc. might work, but then I noticed that a lot of post now contains (for things like I’m) instead of '. And then there are emojis.

So maybe --ascii should use something like https://github.com/anyascii/anyascii#rust (and have the option --unicode keeping the original unicode)?

More informative subject line

I just gave mop3 a try and it is certainly cool. I am however wondering if there is a sane way to generate more informative subject lines. When looking at the mailbox, it is hard to gauge whether a thread is interesting enough to read without opening it.

thread 'main' panicked at 'Server sent malformed JSON ...'

mop3 seems to panick:

RUST_BACKTRACE=full mop3-macos-arm64 --account "[email protected]" \
  --token "..." \
  --pop3port 10110 \
  --ascii --nosmtp

result in the following when pop3 client tries to connect:

Listening on ("127.0.0.1", 10110)
thread 'main' panicked at 'Server sent malformed JSON: Error("expected `,` or `}`", line: 1, column: 9869)', src/main.rs:231:45
stack backtrace:
   0:        0x103017794 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb33e6e8152f78c95
   1:        0x10302ffec - core::fmt::write::hd33da007f7a27e39
   2:        0x103012b94 - std::io::Write::write_fmt::h7edc10723862001e
   3:        0x1030175a8 - std::sys_common::backtrace::print::h895ee35b3f17b334
   4:        0x103018d1c - std::panicking::default_hook::{{closure}}::h3b7ee083edc2ea3e
   5:        0x103018a74 - std::panicking::default_hook::h4e7c2c28eba716f5
   6:        0x103019340 - std::panicking::rust_panic_with_hook::h1672176227032c45
   7:        0x103019160 - std::panicking::begin_panic_handler::{{closure}}::h0b2d072f9624d32e
   8:        0x103017bfc - std::sys_common::backtrace::__rust_end_short_backtrace::he9abda779115b93c
   9:        0x103018ebc - _rust_begin_unwind
  10:        0x103044654 - core::panicking::panic_fmt::h23ae44661fec0889
  11:        0x103044974 - core::result::unwrap_failed::h414a6cbb12b1e143
  12:        0x102d5c6e8 - mop3::handle_pop_connection::h1edde0d9242564ed
  13:        0x102d5892c - mop3::main::h3c3a97baba12433a
  14:        0x102d32678 - std::sys_common::backtrace::__rust_begin_short_backtrace::h0d27018abf24d9ca
  15:        0x102d32834 - std::rt::lang_start::{{closure}}::h966e38f1108142fc
  16:        0x10300ea00 - std::rt::lang_start_internal::h00a235e820a7f01c
  17:        0x102d63e1c - _main

Persist state between mop3 restarts

Restarting mop3 results in the pop3 client (e.g., thunderbird) seeing & downloading the "last n timeline messages" again. Ideally, mop3 would remember which messages were already fetched (& deleted) to avoid the re-downloads and subsequent duplicates.

Format code with rustfmt?

The Rust toolchain comes with rustfmt to format code to a standard format, run via cargo fmt. Would you be interested in running it on this code or a contribution that did it. I think it would tidy it up and make it look more familiar/idiomatic.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.