-
Notifications
You must be signed in to change notification settings - Fork 5
BitMaelum email bridge
In order to allow a smooth transition to BitMaelum we've created a bridge service between regular email to/from BitMaelum network. This bridge will run a service on your machine and it will translate BitMaelum messages back and forth regular email so you can use your current email reader while using the BitMaelum network. This way you can send end-to-end encrypted mails to others BitMaelum users and also be able to send and receive messages from/to regular email accounts. Keep in mind that when sending or receiving emails from the "outside world" they won't be e2e encrypted, they will only be encrypted from our SMTP server to your machine and viceversa.
You will need to run bm-bridge
on your machine, where you have your vault, which it will expose both a IMAP and SMTP service so you can setup your local mail client to use this servers.
Here is an example by running bm-bridge
with this parameters
./bm-bridge --imaphost 127.0.0.1:1143 --smtphost 127.0.0.1:1025
Then you will need to setup your mail client like this
- Server localhost
- IMAP port 1143
- IMAP security none
- SMTP port 1025
- SMTP security none
- Username [the account you want to use without the trailing !]
- Password [any password will be accepted]
In order to send messages from your mail client to others BitMaelum users you should use this format [account_withouth_trailing_!]@bitmaelum.network
so if you want to send a message to johndoe!
you will need to send the mail to johndoe@bitmaelum.network
.
When sending an email to a regular email account the bm-bridge
will actually send the message to mailgateway!
account which it will use a SMTP server (which is actually the bm-bridge
in a special "gateway" mode) to send the message to the destination email address.
The same will happen when someone sends an email to your "special" email address johndoe@bitmaelum.network
. The SMTP server will receive this email and the mailgateway!
account will forward it to you.
Regular email use MIME to send and display regular email. However BitMaelum uses a completely different system based on a header, catalog, blocks and attachments so we need to translate mail to BitMaelum.
Since MIME is basically a chain of data we read this chain and convert each part to either a block or an attachment while keeping the mime structure on a special block so it can be reconstructed back.
Regular MIME message BitMaelum message (only showing blocks & attachments parts)
+--------------------------------------------------+ +--------------------------------------------------+
| Message-ID: <382746194663912@gmail.com> | | BLOCK "default" |
| Date: Tue, 09 Feb 2021 09:44:23 -0800 (PST) | | |
| From: John Doe <john.doe@gmail.com> | | Hey Jane! I just find and I though it's pretty |
| Subject: Hello! | | cool. BitMaelum <http://bitmaelum.com> |
| To: Jane Doe <janedoe@bitmaelum.network> | +--------------------------------------------------+
| Content-Type: multipart/mixed; |
| boundary="0000000000003e9f5405baead6bc"; | +--------------------------------------------------+
| | | BLOCK "text/html" |
| --0000000000003e9f5405baead6bc | | |
| Content-Type: multipart/alternative; | | <html> |
| boundary="0000000000003e9f8205baead6be" | | <body> |
| | | Hey Jane! I just find and I though it's pretty |
| --0000000000003e9f8205baead6be | | cool. <a href="http://bitmaelum.com">BitMaelum</ |
| Content-Type: text/plain; charset="UTF-8" | | a> |
| | ====> +--------------------------------------------------+
| Hey Jane! I just find and I though it's pretty |
| cool. BitMaelum <http://bitmaelum.com> | +--------------------------------------------------+
| | | ATTACHMENT "icon.png" |
| --0000000000003e9f8205baead6be | | |
| Content-Type: text/html; charset="UTF-8" | | [BINARY DATA] |
| | +--------------------------------------------------+
| <html> |
| <body> | +--------------------------------------------------+
| Hey Jane! I just find and I though it's pretty | | BLOCK "mimeparts" |
| cool. <a href="http://bitmaelum.com">BitMaelum</ | | |
| a> | | Content-Type: multipart/mixed; |
| | | boundary="0000000000003e9f5405baead6bc"; |
| --0000000000003e9f8205baead6be-- | | |
| --0000000000003e9f5405baead6bc | | --0000000000003e9f8205baead6bc |
| Content-Type: image/png; name="icon.png" | | Content-Type: multipart/alternative; |
| Content-Disposition: attachment; | | boundary="0000000000003e9f8205baead6be" |
| filename="icon.png" | | |
| Content-Transfer-Encoding: base64 | | --0000000000003e9f8205baead6be |
| Content-ID: <icon.png> | | Content-Type: text/plain; charset="UTF-8" |
| | | X-Bitmaelum-Block: default |
| [BASE64_IMAGE_CHUNK] | | |
| --0000000000003e9f5405baead6bc-- | | --0000000000003e9f8205baead6be |
+--------------------------------------------------+ | Content-Type: text/html; charset="UTF-8" |
| X-Bitmaelum-Block: 55568242-0440-4ba0-8d80-3eb3f2|
| fd2bac |
| |
| --0000000000003e9f8205baead6be-- |
| --0000000000003e9f5405baead6bc |
| Content-Type: image/png; name="icon.png" |
| Content-Disposition: attachment; |
| filename="icon.png" |
| Content-Transfer-Encoding: base64 |
| Content-ID: <icon.png> |
| |
| --0000000000003e9f5405baead6bc-- |
+--------------------------------------------------+
In a similar way we can translate BitMaelum messages to MIME format
+-----------------------------+ +---------------------------------------------+
| BLOCK "default" | | From: johndoe@bitmaelum.network |
| | | To: jane@gmail.com |
| Hey! how are you? Check the | | Date: Tue, 09 Feb 2021 09:44:23 -0800 (PST) |
| attachment I just sent you. | | Subject: Check this |
+-----------------------------+ | Content-Type: multipart/mixed; |
====> | boundary="dummyBoundary" |
+-----------------------------+ | |
| ATTACHMENT "image.jpg" | | --dummyBoundary |
| | | Content-Type: text/plain |
| [BINARY DATA] | | |
+-----------------------------+ | Hey! how are you? Check the attachment I ju |
| st sent you. |
| |
| --dummyBoundary |
| Content-Type: application/octet-stream |
| Content-Disposition: attachment; |
| filename="image.jpg" |
| Content-Transfer-Encoding: base64 |
| |
| [BASE64 CHUNK] |
| --dummyBoundary-- |
+---------------------------------------------+
As stated earlier, when sending an message to the "outside world"(TM), the bridge will send it to mailgateway!
. So in order for mailgateway!
to know where to send the mail to, the bm-bridge
add a block called "destination" with the email address as a destination.
So if we want to send an email using bm-client
we should issue this command:
./bm-client message compose -f johndoe! -t mailgateway! -s "Mail sending test" -b "default,How are you?, I'm testing the mail gateway" -b "destination,janedoe@gmail.com"