Bitmessage Forum

General Discussion => General Discussion => Topic started by: AyrA on April 26, 2013, 06:17:34 AM

Title: B2M | C# Bitmessage E-Mail Gateway | Now open source
Post by: AyrA on April 26, 2013, 06:17:34 AM
Bitmessage to E-mail Gateway
Apart from bitmessage.ch (https://bitmessage.ch) I am working on a local bitmessage to Email gateway so you can put PyBitmessage, B2M and your E-Mail application on a USB Drive for on the go mail support.
If the receiver uses this gateway too you can send each other multipart messages with attachments.

Download
The current version can be downloaded here (https://bitmessage.ch/BitServer.zip).
This is currently a Windows Only Application but I eventually will release its source code so people can modify it to fit their needs and operating systems.
It's open source now: https://github.com/AyrA/BitMailServer (https://github.com/AyrA/BitMailServer)
Last Changes
Requirements
Features included:
Future enhancements:
Installation Instructions:Setting up keys.dat:

Open the keys.dat File in Notepad, the easiest way to do this, is to open notepad, and drag the file onto it.
in the [bitmessagesettings] section, paste the folowing code into it: (keep spaces around the "=" sign)
Code: [Select]
apienabled = true
apiport = 8442
apiinterface = 127.0.0.1
apiusername = whatever
apipassword = bitmessage.ch

You may change the username and Password if you like.
If some of the parameters above are already present in the file, delete them first.


Usage:
Once the keys.dat is set up properly, just run the Application, it sets up itself and is portable.
You can close the gateway anytime with its tray Icon.
To broadcast, send an address to broadcast at bitmesage.ch
To receive Broadcasts, open the Bitmessage GUI and subscribe to the specific Addresses you want.

Screenshots:
Settings window:
This Window allows you to setup the Application and enable/disable features.
(https://ayra.ch/images/screens/2013_06_04__00_06_03.png)

Example of a Message with an Attachment:
The Application (if the "Strip Headers" Option is not enabled) fully supports E-mail MIME Format.
(https://ayra.ch/images/screens/2013_05_30__01_35_40.png)

E-mail Configuration:
Set your E-mail address to <BM-Addr>@bitmessage.ch. If you have multiple addresses, use the one you intend to use most or create multiple accounts in your Application (not recommended, because they share the inbox).
Set your username and password to whatever you want.
Select POP3 protocol (do not use IMAP).
Enter localhost (or 127.0.0.1) for both POP3 and SMTP server.
Disable SMTP authentication (on Outlook, this is set by default).

Example Configuration Screen in Outlook:
(https://ayra.ch/images/screens/2013_04_27__23_38_39.png)

Using multiple Addresses:
If you want to use multiple Bitmessage Addresses you do not need to configure multiple accounts. All incomming messages are received over POP no matter what address logs in. You can send from each addres you own. Just enable the "From" field in your E-Mail client and enter any <BM-addr>@bitmessage.ch sender you own.

Configuring via E-mail:
Send an E-mail to cmd @ bitmessage.ch with the text "help" in the subject. You will then get an incomming E-mail with instructions.

Using disposable Addresses:
Set random at bitmessage.ch as your sending address and any message you send will generate a unique random address.

Donations:
If you like this software you can donate using Bitcoin: 1ML5aXvR3WTn2vB3ehTgqyZUhSGDjVWe4B


Why @bitmessage.ch
bitmessage.ch is my domain, which is used for the public bitmessage gateway (http://bitmessage.ch). By using bitmessage.ch I can guarantee, that E-Mail clients accept the mail, due to it being a valid domain. Also I can guarantee, that special addresses (for example broadcast@bitm...) are not used in real.
Your Messages WILL NOT be sent to bitmessage.ch, this was just used to make your address a valid E-Mail Address to prevent some spam filters from sorting it out.
Title: Re: B2M | Bitmessage2Mail Gateway
Post by: AyrA on April 27, 2013, 05:50:46 PM
Sidenote: never enter "NOOP" when connected to the local SMTP server via telnet, he hates that. Also he and the POP3 server get angry if you enter commands/arguments wrong
Title: Re: B2M | Bitmessage2Mail Gateway Download
Post by: AyrA on May 01, 2013, 07:44:51 AM
Update: Made some changes to the code to handle E-Mail clients better, that do not wait for an answer between command.
Title: Re: B2M | Bitmessage2Mail Gateway Download
Post by: AyrA on May 07, 2013, 05:25:20 AM
Update: Made Header Pasring a bit more efficient and robust.
Title: Re: B2M | Bitmessage2Mail Gateway Download
Post by: AyrA on May 07, 2013, 07:41:00 AM
Solved a Bug that made the application crash with thunderbird
Title: Re: B2M | Bitmessage2Mail Gateway Download
Post by: dokument on May 08, 2013, 12:43:11 AM
Is this open source?
Title: Re: B2M | Bitmessage2Mail Gateway Download
Post by: AyrA on May 08, 2013, 03:30:53 AM
currently not. It's still in beta and in development. I plan on releasing its source code, once I am finished with it and do not plan on programming on it any further. Also the code is written without any public accepted guidlines so probably nobody would understand what I did there. Need to clean it up first.
Title: Re: B2M | Bitmessage2Mail Gateway Download
Post by: AyrA on May 27, 2013, 09:14:09 AM
I updated the Application. It no longer opens a nasty Console window. Instead it places itself in the system Tray and allows to exit with a right click.
Title: Re: B2M | Bitmessage2Mail Gateway Download
Post by: AyrA on May 29, 2013, 07:30:05 PM
Next Update released. It can no properly send and receive HTML Mails with attachments and embedded Images. Includes Mails to and from Mailing Lists.
Title: Re: B2M | Bitmessage2Mail Gateway Download
Post by: pointychimp on May 29, 2013, 08:28:49 PM
Trying it out, so far it works fine with Thunderbird. If I continue to find it useful, I'll definitely donate. I think this is a step in the right direction for bitmessage. Of course ... I just found out about it a few days ago ... so what do I know!


edit: and I would really love to see it become open source in the very near future.
Title: Re: B2M | Bitmessage2Mail Gateway Download
Post by: AyrA on May 30, 2013, 04:25:42 PM
Nice to see someone using the stuff I make. However, keep in mind, that it will send your E-mail headers into bitmessage too. People without this Application have to crawl through the Headers to find the text you wrote.
If you use it together with other users it works great.
Title: Re: B2M | Bitmessage2Mail Gateway Download
Post by: AyrA on June 03, 2013, 06:21:31 PM
new Update!
Major Changes:

The Application has now a settings Window and allows to strip E-mail Headers from Messages.
Title: Re: B2M | Bitmessage2Mail Gateway Download
Post by: AyrA on June 04, 2013, 06:06:16 PM
new Update!
Major Changes:

The Application will remove quoted printable encoding from messages when "strip E-mail Headers from Messages" is enabled.
Quoted printable will replace special chars with =XX, where XX is the uppercase hexadecimal representation, making messages harder to read for bitmessage client users. Enabling the "strip Headers" checkbox will replace these encodings with their char, if it is valid.
Title: Re: B2M | Bitmessage2Mail Gateway Download
Post by: AyrA on June 19, 2013, 07:31:30 AM
You can now send S/MIME encrypted E-Mails with this tool if you have a certificate. (Requires you to turn "Strip Headers" off)
Title: Re: B2M | Bitmessage2Mail Gateway Download
Post by: AyrA on June 27, 2013, 09:15:04 AM
I just made it open source: https://github.com/AyrA/BitMailServer
Title: Re: B2M | C# Bitmessage E-Mail Gateway | Now open source
Post by: AyrA on July 07, 2013, 02:40:28 PM
New Version, you can configure it now via cmd@bitmessage.ch. Just send an E-mail with "help" in the subject to the specified address and you get an answer mail with instructions and available commands.
Title: Re: B2M | C# Bitmessage E-Mail Gateway | Now open source
Post by: joesmoe on January 14, 2014, 11:24:58 PM
New Version, you can configure it now via cmd@bitmessage.ch. Just send an E-mail with "help" in the subject to the specified address and you get an answer mail with instructions and available commands.

This isn't working for me...Does this have to be done via webmail or can it also be done via thunderbird?

Also, is it possible to subscribe to any of the lists with bitmessage.ch? It would be much nicer to have those in thunderbird instead of the bitmessage native app.
Title: Re: B2M | C# Bitmessage E-Mail Gateway | Now open source
Post by: AyrA on January 15, 2014, 01:41:52 AM
You are mistaking this gateway with the bitmessage.ch service.
No, you cannot subscribe to lists currently.
Title: Re: B2M | C# Bitmessage E-Mail Gateway | Now open source
Post by: tester on February 04, 2014, 09:39:24 AM
I tried it with thunderbird portable and it works fine. I've got two suggstions:
- provide a binary for Mac OS X
- only get the messages for the account that logged in (maybe optional)
Title: Re: B2M | C# Bitmessage E-Mail Gateway | Now open source
Post by: AyrA on February 04, 2014, 04:26:49 PM
- provide a binary for Mac OS X
C# is a product from microsoft which by default runs only on windows because Mac OS does not has a .NET Framework.
Title: Re: B2M | C# Bitmessage E-Mail Gateway | Now open source
Post by: Captain_Christopher on April 20, 2014, 03:13:29 PM
I'm looking for an local replacement for https://bitmessage.ch/
since the registration for new accounts has been closed. and I have questions.

First question, would you be able to make a guide on how to set this up with Thunderbird ?
the Thunderbird has more detailed settings then the ones shown in  "Example Configuration Screen in Outlook:" such as which port-numbers to use, how the password is transmitted etc.

Second question you mention that attachments are supported, is there still the 2 mb limit as on https://bitmessage.ch/ or would the limit be the 180 mb shown here https://bitmessage.org/wiki/FAQ if connecting to someone else using bit-message ? and I think the standard email should be about 5 to 10 mb (depending on the path it takes)

third question, I have set up B2M with Thunderbird the best I could, however when I attempt to send an email it doesn't leave my machine, as best as I can tell, I get no error message, and if I open bitmessagepy it shows the message as "message sent, waiting for acknowledgement". it never receives that acknowledgement, the echo server never replies back, and when I attempt to send an email to another email account I own the message is never received. bitmessagepy shows a yellow indicator and I am told that means that it should be properly connecting to the network. sending to cmd@bitmessage.ch with the subject "help" does work and I do get a reply back. do you have any idea's on what I am doing wrong?
Title: Re: B2M | C# Bitmessage E-Mail Gateway | Now open source
Post by: AyrA on April 22, 2014, 02:10:00 AM
I'm looking for an local replacement for https://bitmessage.ch/ (https://bitmessage.ch/)
since the registration for new accounts has been closed. and I have questions.
The registration should open again at the end of the month.

First question, would you be able to make a guide on how to set this up with Thunderbird ?
the Thunderbird has more detailed settings then the ones shown in  "Example Configuration Screen in Outlook:" such as which port-numbers to use, how the password is transmitted etc.
I can do that. Stick to the default settings if you are not sure, what to do (do not use encryption btw)

Second question you mention that attachments are supported, is there still the 2 mb limit as on https://bitmessage.ch/ (https://bitmessage.ch/) or would the limit be the 180 mb shown here https://bitmessage.org/wiki/FAQ (https://bitmessage.org/wiki/FAQ) if connecting to someone else using bit-message ? and I think the standard email should be about 5 to 10 mb (depending on the path it takes)
The Message size is limited by bitmessage only. 180 is a theoretical limit and was decreased to 20 mb a few days ago

third question, I have set up B2M with Thunderbird the best I could, however when I attempt to send an email it doesn't leave my machine, as best as I can tell, I get no error message, and if I open bitmessagepy it shows the message as "message sent, waiting for acknowledgement". it never receives that acknowledgement, the echo server never replies back, and when I attempt to send an email to another email account I own the message is never received. bitmessagepy shows a yellow indicator and I am told that means that it should be properly connecting to the network. sending to cmd@bitmessage.ch with the subject "help" does work and I do get a reply back. do you have any idea's on what I am doing wrong?

If you do not get the acknowledgement, this is a bitmessage issue. As soon as the message shows up in the "sent" tab of the bitmessage client (not thunderbird) it is processed. You get acknowledgement, once the message is delivered. The Person you try to reach probably is unavailable. Try sending a Message to BM-GtkZoid3xpTUnwxezDfpWtYAfY6vgyHd and you should get a reply.
Title: Re: B2M | C# Bitmessage E-Mail Gateway | Now open source
Post by: Captain_Christopher on April 23, 2014, 09:52:45 AM
Quote
The registration should open again at the end of the month.

I'm glad to here it :), I really love that service. (I wish you allowed bigger file attachments though...)

Quote
Stick to the default settings if you are not sure, what to do (do not use encryption btw)

I think I got it working. I  trouble with the port-numbers and after it insulted me a few times I found that 25 for the outgoing server works, the biggest problem was testing server "BM-orkCbppXWSqPpAxnz6jnfTZ2djb5pJKDb" took like 2 days to reply, I tried different testing servers and it worked fine.

 :-[ I had also attempted to add apinotifypath = .//BitServer.exe to the key's.dat in an effort to have pybitmessage start up BitServer.exe when launched (which it did, however it caused .net errors every-time a message was received) would it be possible to add an option to B2M to launch pybitmessage and or your email client when it's run ? (in the mean time I'll just use a batch-file to do it)

Quote
The Message size is limited by bitmessage only. 180 is a theoretical limit and was decreased to 20 mb a few days ago
good to know, it's a shame the limit was reduced that was quite an exciting feature of bit-message.

so everything on the bit-message side works, now the only question is how to I get this thing to work with standard email ? (I know bit-message is intended as a replacement, however as much as I'd rather dump email in favor of bit-message until it receives wider adoption, I still need to be able to have it compilable with standard email.)

thank you very much :)
Title: Re: B2M | C# Bitmessage E-Mail Gateway | Now open source
Post by: AyrA on April 23, 2014, 06:33:54 PM
I'm glad to here it :) , I really love that service. (I wish you allowed bigger file attachments though...)
I am doing POW for over 15'000 users. Increasing the attachment size would drastically decrease the number of processable messages.

I had also attempted to add apinotifypath [...] to start up BitServer.exe when launched (which it did, however it caused .net errors every-time a message was received) would it be possible to add an option to B2M to launch pybitmessage and or your email client when it's run ? (in the mean time I'll just use a batch-file to do it)
This could be added. The error is caused, because every time it starts it tries to listen on specific ports, which are locked after the first instance runs.


good to know, it's a shame the limit was reduced that was quite an exciting feature of bit-message.
Python probably has the poorest multi threading support I have ever seen. When receiving a message, the client is essentially locked until it is completely received, which can take ages for a 180 MB message.

so everything on the bit-message side works, now the only question is how to I get this thing to work with standard email ? (I know bit-message is intended as a replacement, however as much as I'd rather dump email in favor of bit-message until it receives wider adoption, I still need to be able to have it compilable with standard email.)
The application only is a Bitmessage interface, it cannot send mails to external domains and it will never be able to do so. (mails from home IP addresses are usually discarded by modern mail servers if you do not authenticate with it first.)

If you are talking about sending E-Mails with attachments and reconstruct them, disable the "strip headers" option in the client and it will forward E-mails into bitmessage "as is". If the receiver uses the gateway too (or has bitmessage.ch address) he gets the E-Mail including attachments back. If he uses the bitmessace client directly, he will be looking at a big pile of almost unreadable crap in BitMessage.
Title: Re: B2M | C# Bitmessage E-Mail Gateway | Now open source
Post by: Captain_Christopher on April 23, 2014, 07:47:26 PM
I am doing POW for over 15'000 users. Increasing the attachment size would drastically decrease the number of processable messages.
I figured as much, what kind of machine do you have doing all this ?

This could be added.
well that would be wonderful, since it'd be nice not to have to launch everything manually, pybitmessage, Bitserver, Then Thunderbird, and thanks for the explanation of that error.

Python probably has the poorest multi threading support I have ever seen
THANK YOU ! now if only you could convince my engineering professor of this. I had an A+ in that course but really hated programing in python.... back on topic though, wouldn't that possibly provide a vector for a DOS attack ? basically send many large attachments to lock up the client on the recipient's computer and prevent it from functioning.

The application only is a Bitmessage interface
thank you for clearing that up everything seems to be working now.
Title: Re: B2M | C# Bitmessage E-Mail Gateway | Now open source
Post by: lostfile on August 29, 2015, 08:56:41 AM
its it possible to run it as a daemon?
Title: Re: B2M | C# Bitmessage E-Mail Gateway | Now open source
Post by: AyrA on August 29, 2015, 10:56:27 AM
its it possible to run it as a daemon?


Not the way it is made by now. The Application is open source and does not actually needs the GUI. You can rewrite it into a Service if you want to. Windows Services are different from linux daemons because they need to export certain functions that windows can call to start/stop/pause the service. If you are not familiar with this, there is a tutorial by microsoft: https://msdn.microsoft.com/en-us/library/zt39148a(v=vs.90).aspx