Giter Site home page Giter Site logo

neilalexander / yggmail Goto Github PK

View Code? Open in Web Editor NEW
130.0 9.0 17.0 171 KB

End-to-end encrypted email for the mesh networking age

Home Page: https://matrix.to/#/#yggmail:matrix.org

License: Mozilla Public License 2.0

Go 99.10% Dockerfile 0.90%
email mesh mesh-networks mesh-networking yggdrasil-network yggdrasil smtp imap smtp-server imap-server

yggmail's Introduction

Yggmail

It's email, but not as you know it.

Introduction

Yggmail is a single-binary all-in-one mail transfer agent which sends and receives email natively over the Yggdrasil Network.

  • Yggmail runs just about anywhere you like — your inbox is stored right on your own machine;
  • Implements IMAP and SMTP protocols for sending and receiving mail, so you can use your favourite client (hopefully);
  • Mails are exchanged between Yggmail users using built-in Yggdrasil connectivity;
  • All mail exchange traffic between any two Yggmail nodes is always end-to-end encrypted without exception;
  • Yggdrasil and Yggmail nodes on the same network are discovered automatically using multicast or you can configure a static Yggdrasil peer.

Email addresses are based on your public key, like 89cd1ea25d99b8ccf29e454280313128c234ffb82aa0eb2e3496f6f156d063d0@yggmail.

Why?

There are all sorts of messaging services in the world but there is still a lot of value in asynchronous communication. Email is something that a lot of people understand reasonably well and there is still a huge volume of software in the world which supports email. Yggmail is designed to comply with the standards that people know and expect.

Yggdrasil is well-suited for ad-hoc mail delivery and allows Yggmail to work even in closed networks, where Internet or other connectivity is restricted or simply not available. It guarantees end-to-end encryption and handles networks with changing topologies reasonably well.

Quickstart

Use a recent version of Go to install Yggmail:

go install github.com/neilalexander/yggmail/cmd/yggmail@latest

It will then be installed into your GOPATH, so add that to your environment:

export PATH=$PATH:`go env GOPATH`/bin

Create a mailbox and set your password. Your Yggmail database will automatically be created in your working directory if it doesn't already exist:

yggmail -password

Start Yggmail, using the database in your working directory, with either multicast enabled, an Yggdrasil static peer specified or both:

yggmail -multicast
yggmail -peer=tls://...
yggmail -multicast -peer=tls://...

Your mail address will be printed in the log at startup. You will also use this as your username when you log into SMTP/IMAP.

Connect your mail client to Yggmail. In the above example:

  • SMTP is listening on localhost port 1025, username is your mail address, plain password authentication, no SSL/TLS
  • IMAP is listening on localhost port 1143, username is your mail address, plain password authentication, no SSL/TLS

Then try sending a mail to another Yggmail user!

Parameters

The following command line switches are supported by the yggmail binary:

  • -peer=tls://... or -peer=tcp://... — connect to a specific Yggdrasil node, like one of the Public Peers;
  • -multicast - enable multicast peer discovery for Yggdrasil nodes on your LAN
  • -database=/path/to/yggmail.db — use a specific database file;
  • -smtp=listenaddr:port — listen for SMTP on a specific address/port
  • -imap=listenaddr:port — listen for IMAP on a specific address/port;
  • -password — set your IMAP/SMTP password (doesn't matter if Yggmail is running or not, just make sure that Yggmail is pointing at the right database file or that you are in the right working directory).

Notes

There are a few important notes:

  • Yggmail needs to be running in order to receive inbound emails — it's therefore important to run Yggmail somewhere that will have good uptime;
  • Yggmail tries to guarantee that senders are who they say they are. Your From address must be your Yggmail address;
  • You can only email other Yggmail users, not regular email addresses on the public Internet;
  • You may need to configure your client to allow "insecure" or "plaintext" authentication to IMAP/SMTP — this is because we don't support SSL/TLS on the IMAP/SMTP listeners yet;
  • Yggmail won't transport mails larger than 1MB right now.

Bugs

There are probably all sorts of bugs, but the ones that we know of are:

  • IMAP behaviour might not be entirely spec-compliant in all cases, so your mileage with mail clients might vary;
  • IMAP search isn't implemented yet and will instead return all mails.

The code's also a bit of a mess, so sorry about that.

yggmail's People

Contributors

neilalexander avatar stmllr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yggmail's Issues

add gobinaries link to the README

Describe the bug

Just thought the README misses those two links/cmds for fast install

but, for now it complains with

$ cat yggmail
echo
printf "  \033[38;5;125mError:\033[0;00m Repository has no tags\n"
echo
exit 1

https://gobinaries.com/

the windows link does not exactly produce a .exe, deal with it.

Yggmail should report back to user if email failed to send

Is your feature request related to a problem? Please describe.
The yggmail service I'm sending the email to is down but I am not made aware.

Describe the solution you'd like
I would like for my yggmail server to return an email to me letting me know that sending that email failed and for what reason.

Describe alternatives you've considered
N/A

Additional context
Postfix does something like this by default.

Thunderbird "Get Messages" is inconsistent

Describe the bug
Thunderbird's "Get Messages" button is inconsistent. When it doesn't work it seems like the only solution is to restart Thunderbird.

Desktop:

  • OS: Debian 10
  • Client: Thunderbird
  • Version: 78.11.0

Additional context
Might be related to the lack of IMAP Notify support.

Running yggmail together with yggdrasil

Please tell me, is it possible to run yggmail on the same computer where yggdrasil is running, without using virtualization?
I think it would be convenient to use a single tun-adapter...

Notice: Connection doesn't allow setting of receive buffer size

By running with systemd unit I have this notice in error log:

connection doesn't allow setting of receive buffer size. Not a *net.UDPConn?. See https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes for details.

What is this means in simple words?

p.s. I don't use quic just tls peer on launch

Thanks

There is no proper closing storage

Describe the bug
I'm not sure but I can't find proper storage closing routines so there are a chance to broke database file.

To Reproduce
Not tested, but I think database will broke if close yggmail while there are some working write operations.

Expected behavior
Handle SIGINT signal.

The latest version of yggmail floods in the log

I updated Yggmail today and immediately noticed that the log is growing a lot due to an error.

sudo journalctl -u yggmail --since today -e

окт 19 13:09:24 pi yggmail[32757]: 2022/10/19 13:09:24 [  Yggmail  ] Listening for SMTP on: 192.168.1.15:1025
окт 19 13:09:24 pi yggmail[32757]: 2022/10/19 13:09:24 [ Yggdrasil ] Connected TCP: [email protected], source 192.168.1.15
окт 19 13:09:24 pi yggmail[32757]: 2022/10/19 13:09:24 [ Yggdrasil ] TLS listener started on [fe80::8c63:de15:b147:9591%eth0]:37781
окт 19 13:09:24 pi yggmail[32757]: 2022/10/19 13:09:24 [ Yggdrasil ] Connected TLS: peer_IPv6@fe80::8c63:de15:b147:9591, >
окт 19 13:09:25 pi yggmail[32757]: 2022/10/19 13:09:25 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:09:26 pi yggmail[32757]: 2022/10/19 13:09:26 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:09:27 pi yggmail[32757]: 2022/10/19 13:09:27 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:09:28 pi yggmail[32757]: 2022/10/19 13:09:28 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:09:29 pi yggmail[32757]: 2022/10/19 13:09:29 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:18 pi yggmail[32757]: 2022/10/19 13:10:18 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:19 pi yggmail[32757]: 2022/10/19 13:10:19 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:20 pi yggmail[32757]: 2022/10/19 13:10:20 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:21 pi yggmail[32757]: 2022/10/19 13:10:21 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:22 pi yggmail[32757]: 2022/10/19 13:10:22 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:23 pi yggmail[32757]: 2022/10/19 13:10:23 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:24 pi yggmail[32757]: 2022/10/19 13:10:24 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:25 pi yggmail[32757]: 2022/10/19 13:10:25 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:26 pi yggmail[32757]: 2022/10/19 13:10:26 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:27 pi yggmail[32757]: 2022/10/19 13:10:27 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:28 pi yggmail[32757]: 2022/10/19 13:10:28 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:29 pi yggmail[32757]: 2022/10/19 13:10:29 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:30 pi yggmail[32757]: 2022/10/19 13:10:30 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:31 pi yggmail[32757]: 2022/10/19 13:10:31 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: read tcp [fe80::8c63:de15:b>
окт 19 13:10:32 pi yggmail[32757]: 2022/10/19 13:10:32 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: read tcp [fe80::8c63:de15:b>
окт 19 13:10:33 pi yggmail[32757]: 2022/10/19 13:10:33 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:34 pi yggmail[32757]: 2022/10/19 13:10:34 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:35 pi yggmail[32757]: 2022/10/19 13:10:35 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:36 pi yggmail[32757]: 2022/10/19 13:10:36 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:37 pi yggmail[32757]: 2022/10/19 13:10:37 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:38 pi yggmail[32757]: 2022/10/19 13:10:38 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:39 pi yggmail[32757]: 2022/10/19 13:10:39 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:40 pi yggmail[32757]: 2022/10/19 13:10:40 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:41 pi yggmail[32757]: 2022/10/19 13:10:41 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:42 pi yggmail[32757]: 2022/10/19 13:10:42 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:43 pi yggmail[32757]: 2022/10/19 13:10:43 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:44 pi yggmail[32757]: 2022/10/19 13:10:44 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:45 pi yggmail[32757]: 2022/10/19 13:10:45 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:46 pi yggmail[32757]: 2022/10/19 13:10:46 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:47 pi yggmail[32757]: 2022/10/19 13:10:47 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:48 pi yggmail[32757]: 2022/10/19 13:10:48 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:49 pi yggmail[32757]: 2022/10/19 13:10:49 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:50 pi yggmail[32757]: 2022/10/19 13:10:50 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:51 pi yggmail[32757]: 2022/10/19 13:10:51 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:52 pi yggmail[32757]: 2022/10/19 13:10:52 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:53 pi yggmail[32757]: 2022/10/19 13:10:53 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:54 pi yggmail[32757]: 2022/10/19 13:10:54 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:55 pi yggmail[32757]: 2022/10/19 13:10:55 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:56 pi yggmail[32757]: 2022/10/19 13:10:56 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:57 pi yggmail[32757]: 2022/10/19 13:10:57 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:58 pi yggmail[32757]: 2022/10/19 13:10:58 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:10:59 pi yggmail[32757]: 2022/10/19 13:10:59 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:11:00 pi yggmail[32757]: 2022/10/19 13:11:00 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
окт 19 13:11:01 pi yggmail[32757]: 2022/10/19 13:11:01 [ Yggdrasil ] Failed to dial TLS [fe80::ab08:a3c0:1ad8:89c]:46717: EOF
...

How can I prevent him from opening listener on fe80::ab08:a3c0:1ad8:89c?
How can I disable the output of these messages?

It is launched from the systemd unit like this:
yggmail -peer=tcp://192.168.1.15:22854 -database=/home/USER/go/bin/yggmail.db -smtp=192.168.1.15:1025 -imap=192.168.1.15:1143

Add DNS-based aliases

Is your feature request related to a problem? Please describe.
In the current version of yggmail, it is quite difficult to remember or share addresses like e8a6d1decc5c53b657bf57c546b894c7f07bcebf9a1bcc09de00d7a03d7e5366@yggmail.

Describe the solution you'd like
It is possible to use ALFIS (or any other DNS) to solve this problem. You can add a TXT record to _yggmail.domain.tld containing the yggmail public key. When sending a message to domain@tld, yggmail will extract the public key from the DNS, and send the message to the {public key}@yggmail

Error: "Failed to get mail 2 due to error: sql: no rows in result set"

Describe the bug
I get this error in the logs:

[  Yggmail  ] Queued mail for [4c5c81b8379f58ab0f3af9ed186988fb2a05a7c0c90829283e8bb9f0e3438058@yggmail]                                                              
[  Yggmail  ] There are 2 mail(s) queued for 4c5c81b8379f58ab0f3af9ed186988fb2a05a7c0c90829283e8bb9f0e3438058                                                         
[  Yggmail  ] Sending mail from 439a18f3692be6cc3bdf724994d6027a1dc457ef8adf33d68564205c03b3ad46@yggmail to 4c5c81b8379f58ab0f3af9ed186988fb2a05a7c0c90829283e8bb9f0e3438058                                                                                                                                                                 
[  Yggmail  ] Queued mail for [4c5c81b8379f58ab0f3af9ed186988fb2a05a7c0c90829283e8bb9f0e3438058@yggmail]                                                              
[  Yggmail  ] Sent mail from 439a18f3692be6cc3bdf724994d6027a1dc457ef8adf33d68564205c03b3ad46@yggmail to 4c5c81b8379f58ab0f3af9ed186988fb2a05a7c0c90829283e8bb9f0e3438058                                                                                                                                                                    
[  Yggmail  ] Failed to get mail 2 due to error: sql: no rows in result set
[  Yggmail  ] Incoming SMTP session from 4c5c81b8379f58ab0f3af9ed186988fb2a05a7c0c90829283e8bb9f0e3438058
// [...] THE SECOND QUEUED MESSAGE WAS NOT SENT DUE TO THE PREVIOUS ERROR

Feature Request: Host yggmail for others

Is your feature request related to a problem? Please describe.
Yes. As my home computer doesn't switch on always, I have to host my yggmail server on a VPS, but VPS already has a yggdrasil node running with its own pubkey.

Describe the solution you'd like
Allow to host yggmail for others. (Maybe through some kind of delegation? Signing authorization from A to allow B to received his email.)

Listen on internal ygg address

Similar use case to the one described by Revertron in #8. It would be very useful to be able to listen on the internal ygg address for SMTP and IMAP services.

Another use case I envisioned would be an easy manageable backup system in which you for example use litestream for backups and when the main VM dies, a new instance of YggMail could be spun up, to which the clients can still connect with the same address.

Non-ygg-side SMTP does not support AUTH LOGIN

Describe the bug
Attempting to log into a yggmail instance with AUTH LOGIN causes a panic:

220 <Snip> ESMTP Service Ready
EHLO host
250-Hello host
250-PIPELINING
250-8BITMIME
250-ENHANCEDSTATUSCODES
250-CHUNKING
250-AUTH PLAIN LOGIN
250 SIZE 1048576
AUTH LOGIN
334 VXNlcm5hbWU6
<Snip>
334 UGFzc3dvcmQ6
<Snip>
421 4.0.0 Internal server error
Connection closed by foreign host.

To Reproduce
Try to log into the yggmail server using AUTH LOGIN. The above is an example transcript.

Expected behavior
The login should proceed as in AUTH PLAIN.

Desktop (please complete the following information):

  • OS: Linux
  • Version: latest?

Additional context
Here's the stack trace of the panic:

goroutine 57647 [running]:
runtime/debug.Stack()
	/usr/share/go/src/runtime/debug/stack.go:24 +0x65
github.com/emersion/go-smtp.(*Conn).handle.func1()
	/home/kappa/go/pkg/mod/github.com/emersion/[email protected]/conn.go:102 +0xc5
panic({0x8891a0, 0xbe9040})
	/usr/share/go/src/runtime/panic.go:1038 +0x215
github.com/neilalexander/yggmail/internal/smtpserver.(*Backend).Login(0xc0000b0880, 0x0, {0xc0001ef400, 0x0}, {0xc0004e20c0, 0x14})
	/home/kappa/go/pkg/mod/github.com/neilalexander/[email protected]/internal/smtpserver/backend.go:58 +0x259
main.main.func1.1.1({0xc0001ef400, 0xc0004e20a8}, {0xc0004e20c0, 0xc0004e20a8})
	/home/kappa/go/pkg/mod/github.com/neilalexander/[email protected]/cmd/yggmail/main.go:183 +0x38
github.com/emersion/go-sasl.(*loginServer).Next(0xc0002b43c0, {0xc0004e20a8, 0xffffffffffffffff, 0xc000120320})
	/home/kappa/go/pkg/mod/github.com/emersion/[email protected]/login.go:81 +0x135
github.com/emersion/go-smtp.(*Conn).handleAuth(0xc000120320, {0xc000212685, 0xc000212685})
	/home/kappa/go/pkg/mod/github.com/emersion/[email protected]/conn.go:549 +0x3d6
github.com/emersion/go-smtp.(*Conn).handle(0xc000120320, {0xc000212680, 0xc000120320}, {0xc000212685, 0x5})
	/home/kappa/go/pkg/mod/github.com/emersion/[email protected]/conn.go:151 +0x1bf
github.com/emersion/go-smtp.(*Server).handleConn(0xc0000da000, 0xc000120320)
	/home/kappa/go/pkg/mod/github.com/emersion/[email protected]/server.go:154 +0x1a5
created by github.com/emersion/go-smtp.(*Server).Serve
	/home/kappa/go/pkg/mod/github.com/emersion/[email protected]/server.go:126 +0x169

Old Yggdrasil version on install

I don't know, bug it or dependency, just for notice (yggdrasil-go v0.5.4 not 0.5.5)

go install github.com/neilalexander/yggmail/cmd/yggmail@latest

go: downloading github.com/neilalexander/yggmail v0.0.0-20231210110143-edf14c0d0373
go: downloading github.com/Arceliar/ironwood v0.0.0-20231127131626-465b82dfb5bd
go: downloading github.com/yggdrasil-network/yggdrasil-go v0.5.4
...

parseAddress: invalid email domain

Latest go version

Configured on localhost, maybe just Mozilla Thunderbird started to validate domains..
Don't remember this message before

Sending of the message failed.
The message was not sent due to exceeding the allowed number of recipients. The server responded: parseAddress: invalid email domain.

Yggmail cannot send an email to itself

Yggmail cannot send an email to itself (to own address), and such an email, as I understand it, remains in the send queue indefinitely, with Yggmail constantly attempting to resend it.

023/12/14 03:11:43 [ Yggmail ] There are 1 mail(s) queued for eb6c3df0c3bf5196d6404d735d04da96c426bbb6c17a668eba362f7658bc2caa
2023/12/14 03:11:43 [ Yggmail ] Sending mail from eb6c3df0c3bf5196d6404d735d04da96c426bbb6c17a668eba362f7658bc2caa@yggmail to eb6c3df0c3bf5196d6404d735d04da96c426bbb6c17a668eba362f7658bc2caa
2023/12/14 03:11:43 [ Yggmail ] Will retry sending to eb6c3df0c3bf5196d6404d735d04da96c426bbb6c17a668eba362f7658bc2caa later due to error: smtp.NewClient: Application error 0x0 (local): Connection replaced

mails queued while server is sending are not sent inmediately

Describe the bug
If the server is sending the list of queued mails and in the mean time new mails are queued, the server doesn't check if new mails were queued and instead thinks the work is done and schedules a re-check in 10 minutes.

To Reproduce
Steps to reproduce the behavior:

  1. send one email while the server is in the process of sending other emails
  2. the messages queued while other were sending are not sent immediately

Log

[  Yggmail  ] Incoming SMTP session from 4c5c81b8379f58ab0f3af9ed186988fb2a05a7c0c90829283e8bb9f0e3438058
[  Yggmail  ] Stored new mail from 4c5c81b8379f58ab0f3af9ed186988fb2a05a7c0c90829283e8bb9f0e3438058@yggmail
[  Yggmail  ] Authenticated IMAP user from 127.0.0.1:50046 as "439a18f3692be6cc3bdf724994d6027a1dc457ef8adf33d68564205c03b3ad46"
[  Yggmail  ] Authenticated IMAP user from 127.0.0.1:50048 as "439a18f3692be6cc3bdf724994d6027a1dc457ef8adf33d68564205c03b3ad46"
[  Yggmail  ] Queued mail for [4c5c81b8379f58ab0f3af9ed186988fb2a05a7c0c90829283e8bb9f0e3438058@yggmail]
[  Yggmail  ] There are 1 mail(s) queued for 4c5c81b8379f58ab0f3af9ed186988fb2a05a7c0c90829283e8bb9f0e3438058
[  Yggmail  ] Sending mail from 439a18f3692be6cc3bdf724994d6027a1dc457ef8adf33d68564205c03b3ad46@yggmail to 4c5c81b8379f58ab0f3af9ed186988fb2a05a7c0c90829283e8bb9f0e3438058
// HERE A SECOND EMAIL WAS QUEUED:
[  Yggmail  ] Queued mail for [4c5c81b8379f58ab0f3af9ed186988fb2a05a7c0c90829283e8bb9f0e3438058@yggmail]
// HERE THE FIRST MAIL WAS SENT BUT THE SERVER DON'T CHECK IF THERE IS SOMETHING NEW IN THE QUEUE:
[  Yggmail  ] Sent mail from 439a18f3692be6cc3bdf724994d6027a1dc457ef8adf33d68564205c03b3ad46@yggmail to 4c5c81b8379f58ab0f3af9ed186988fb2a05a7c0c90829283e8bb9f0e3438058
// ONLY ONE EMAIL SENT, THE SECOND QUEUED EMAIL WAS NOT SENT

Additional context
I realized this while trying a Delta Chat "Echo Bot", that quickly sends one mail with read receipt and another echoing back the text, since this happens too fast, always the second message is queue while the fist one is sending so the second message gets delayed by 10 minutes, or until another message arrives.

Support for Ygg 0.5

Hi Neil,
Just a feature request for Yggmail to support the new v0.5 routing protocol updates.

yggmail via unix socket and Multicast Peer Discovery

A couple of questions )

When I run yggmail like this: yggmail -peer=unix:///var/run/yggdrasil.sock -database=/home/USER/mail/yggmail.db -smtp=192.168.1.15:1025 -imap=192.168.1.15:1143

Every minute the following will be recorded in the log:

2022/10/19 22:29:29 [ Yggdrasil ] Failed to dial UNIX : duplicate connection attempt
2022/10/19 22:30:29 [ Yggdrasil ] Failed to dial UNIX : duplicate connection attempt
2022/10/19 22:31:29 [ Yggdrasil ] Failed to dial UNIX : duplicate connection attempt
...

Is this how it should be?

And second: when I don't specify the -multicast parameter when starting yggmail - does it not disable Multicast Peer Discovery?
Because in the log I see the following:

./yggmail -peer=unix:///var/run/yggdrasil.sock -database=/home/user/mail/yggmail.db -smtp=192.168.1.15:1025 -imap=192.168.1.15:1143
2022/10/20 01:37:05 [  Yggmail  ] Using database file "/home/user/mail/yggmail.db"
2022/10/20 01:37:05 [  Yggmail  ] Mail address: 44ed9bc4a0fafbbc621b73bca3bf62b31c140f18e3ef143559a0143be4e0fe50@yggmail
2022/10/20 01:37:05 [  Yggmail  ] Listening for IMAP on: 192.168.1.15:1143
2022/10/20 01:37:05 [ Yggdrasil ] Connected UNIX: 200:31e:cba5:1c08:758c:5bdf:e04c:8a80@/var/run/yggdrasil.sock, source @
2022/10/20 01:37:05 [  Yggmail  ] Listening for SMTP on: 192.168.1.15:1025
2022/10/20 01:37:05 [ Yggdrasil ] TLS listener started on [fe80::8c63:de15:b147:9591%eth0]:40729

TLS listener started on...

Any type of Yggmail proxy to existing email servers?

Hello,

I am new to Yggdrasil and Yggmail so I am exploring but find the Yggmail to be an interesting project with a lot of potential.

In as much, I seem to have read that the MTA can only talk to other MTA systems on the Yggdrasil network, but I was wondering if there was some type of Yggdrasil mail proxy server that would allow the mail to be sent and received to/from regular existing email servers so that it would extend Yggmail to be able to work like normal email?

Also, it seems that there might be some challenges with the Yggmail email addresses as opposed to standard email addresses, but I have not researched that part yet.

Cheers and have a great day

Support multiple peers

Describe the bug
Currently, if we specify multiple peers yggmail only uses the last one in a line.
It would be better to use all of specified peers.

To Reproduce
Steps to reproduce the behavior:

  1. run yggmail -peer <peer1> -peer <peer2>
  2. Look in the logs and spot that it uses only the last peer.

Expected behavior
It would be better to use all of specified peers.

Brute-force protection

It is very convenient to host yggmail on some VM, and be able to connect to it from any other device in Yggdrasil.
But yggmail is defenseless against brute-force attacks. Anyone can run some script and try to login to SMTP or IMAP part of the node. Moreover, if you connect to the node, it shows a valid login in the banner.

It would be very good to implement some rate-control to login mechanisms with some temporary ban measures.
And get rid of that public key in the banner :)

Allow to configure maximum email size

Is your feature request related to a problem? Please describe.
I can't send attachments bigger than 1MB, currently the server can only be used for text message and small files.

Describe the solution you'd like
Make maximum email size configurable via CLI option, ex. -maxsize or so. Also 1MB is too small in modern times, usually email servers allow 25-50MB, not to say this is a server you probably self-host for yourself, so would be good to set 50MB as default limit, or even "no limit" by default.

Describe alternatives you've considered
Changing the hard-coded value and compiling a custom yggmail :)

Additional context
I am using yggmail with Delta Chat, where it is easy to send animated stickers, gifs and other files, as well as recording voice messages and videos, 1MB is too low

Errors wrapping, logging.

Is your feature request related to a problem? Please describe.
For now, only standard logger and errors libraries are used in this project. I suggest using the xerrors package to wrap errors with a stack trace and the zerolog package as a logger. If we use them, we will not need to additionally log every error but can log them only on the highest level also with the stack trace, which will help us to trace an error. Also, with the zerolog, we can easily split logs into categories (at least debug and all others).

Describe the solution you'd like
I can add these features to the project and create a pull request if you like this idea =)

Describe alternatives you've considered
I would be glad to discuss all the alternatives or additions to my thought.

Not working on Windows (MingW)

Describe the bug
It starts without -password, and seems to work, but I can't send messages from Thunderbird, as yggmail doesn't want connections without password.
If I try to run yggmail with -password, I get this:

[  Yggmail  ] Using database file "yggmail.db"
[  Yggmail  ] Generated new server identity
[  Yggmail  ] Mail address: 8fedf643a96bb837b36e796bf21924bd33cd27021b6092186ccecde320e8c9f9@yggmail
[  Yggmail  ] Please enter your new password:
panic: The handle is invalid.

goroutine 1 [running]:
main.main()
        C:/msys64/home/Revertron/go/pkg/mod/github.com/neilalexander/[email protected]/cmd/yggmail/main.go:91 +0x1255

To Reproduce
Steps to reproduce the behavior:

  1. Make go install github.com/neilalexander/yggmail/cmd/yggmail@latest in MingW64.
  2. Run go/bin/yggmail.exe -peer <some peer> -password.
  3. See the error.

Expected behavior
It should get password from stdin.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Win10, MingW64 (latest)
  • Version: 20210709230215

Mail issues with latest version

Describe the bug
I had two issues when upgrading to the new version (via go install)

  1. My email address changed (no big deal there)
  2. "[ Yggmail ] Failed to authenticate IMAP user due to wrong domain". I'm using the same format as before which is my yggmail email "@yggmail"

To Reproduce
Steps to reproduce the behavior:

  1. Using Thunderbird, follow the instructions to setup an account
  2. Get new mail

Expected behavior
Connection worked

Desktop (please complete the following information):

  • OS: macOS 14.1
  • GO: go version go1.21.3 darwin/amd64

Spam protection

The yggmail is a great implementation of distributed E-mail, but with great abilities comes great responsibility.
Especially, how can we defend our mail inboxes from any malicious agent (spammer) that is able to generate a new identity every 10 milliseconds and spam a lot of messages to every known address?

This issue is more about discussion to find a decent solution to that problem.

fetch bootstrap peer list automatically

i am a bit bored to enter the command line with all the parameters about peers. And i am pretty sure the peer i want to try with will be lost in the middle of the process = )

Have you considered an -auto switch to enable multicast and also a little proc to somehow fetch a random list of peers at https://publicpeers.neilalexander.dev/

It might be possible to detect the user locale (https://stackoverflow.com/a/51838303/4466350) to automatically select the country, or just require an additional value to the aforementioned -auto flag.

Mail quotas

We need to be able to configure the inbox file to not exceed a certain size, and to reject new mails when that size is reached.

Crash when sending mail using claws-mail

Describe the bug
When attempting to send mail using the claws-mail 3.17.8 client, yggmail crashes with "runtime error: invalid memory address or nil pointer dereference". Claws reports "421 4.0.0 Internal server error"

To Reproduce
Steps to reproduce the behavior:
Install Claws 3.17.8
Configure claws to use yggmail
Send an email.

Reproducible Environment
I have also provided a nix-shell environment for your convenience at https://github.com/eatb33ts/yggmail/tree/claws-crash that reproduces the bug with pinned dependencies and preconfigured claws-mail/yggmail and a draft message that will illustrate the bug. If you have the Nix package manager installed, simply switch to that branch and run nix-shell.

Expected behavior
Emails should be sent

Stacktrace

smtp/server 2021/07/18 16:29:54 panic serving 127.0.0.1:46286: runtime error: invalid memory address or nil pointer dereference
goroutine 298 [running]:
runtime/debug.Stack(0xc00035a500, 0x0, 0x0)
        runtime/debug/stack.go:24 +0x9f
github.com/emersion/go-smtp.(*Conn).handle.func1(0xc00035a500)
        github.com/emersion/[email protected]/conn.go:102 +0xfb
panic(0x911460, 0xc3ed70)
        runtime/panic.go:965 +0x1b9
github.com/neilalexander/yggmail/internal/smtpserver.(*Backend).Login(0xc00030e000, 0x0, 0xc00031cb80, 0x40, 0xc000327820, 0x8, 0x0, 0x0, 0x0, 0x0)
        github.com/neilalexander/yggmail/internal/smtpserver/backend.go:50 +0x29f
main.main.func1.1.1(0xc00031cb80, 0x40, 0xc000327820, 0x8, 0x8, 0xc000327810)
        github.com/neilalexander/yggmail/cmd/yggmail/main.go:175 +0x5b
github.com/emersion/go-sasl.(*loginServer).Next(0xc000315050, 0xc000327810, 0x8, 0x9, 0x8, 0x9, 0x0, 0x0, 0x0, 0x0)
        github.com/emersion/[email protected]/login.go:81 +0x1cd
github.com/emersion/go-smtp.(*Conn).handleAuth(0xc00035a500, 0xc000327785, 0x5)
        github.com/emersion/[email protected]/conn.go:549 +0x1e4
github.com/emersion/go-smtp.(*Conn).handle(0xc00035a500, 0xc000327780, 0x4, 0xc000327785, 0x5)
        github.com/emersion/[email protected]/conn.go:151 +0x2d9
github.com/emersion/go-smtp.(*Server).handleConn(0xc00031a000, 0xc00035a500, 0x0, 0x0)
        github.com/emersion/[email protected]/server.go:154 +0x1ea
created by github.com/emersion/go-smtp.(*Server).Serve
        github.com/emersion/[email protected]/server.go:126 +0xff

Desktop

  • OS: NixOS 21.05
  • nixpkgs revision: 7e9b0dff974c89e070da1ad85713ff3c20b0ca97
  • yggmail revision: e0b3f60
  • claws-mail 3.17.8

Additional context
yggmail works fine with thunderbird on the same system.

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.