Codeberg/Community
54
325
Fork
You've already forked Community
12

[Feature request] Issue reply by email #372

Closed
opened 2020年12月24日 15:37:07 +01:00 by cornelius.roemer · 16 comments

One nice Github/Gitlab feature that is missing from Gitea/Codeberg is reply to issue by email.

There's an upstream feature request for this at Gitea https://github.com/go-gitea/gitea/issues/9067 but I was wondering if this was something that could possibly be done just here - so I'll throw it in the ring.

One nice Github/Gitlab feature that is missing from Gitea/Codeberg is reply to issue by email. There's an upstream feature request for this at Gitea https://github.com/go-gitea/gitea/issues/9067 but I was wondering if this was something that could possibly be done just here - so I'll throw it in the ring.

it could posible done by a "bot" who read mails & act for the user via API & sudo header

it could posible done by a "bot" who read mails & act for the user via API & sudo header

There's a WIP PR over at Gitea: https://github.com/go-gitea/gitea/pull/13585

There's a WIP PR over at Gitea: https://github.com/go-gitea/gitea/pull/13585
Member
Copy link

it could posible done by a "bot" who read mails & act for the user via API & sudo header

Considering the security/spam issues brought up in the PR discussion it's probably best to do contribute to the PR and have one centralized implementation that is easier to maintain?

> it could posible done by a "bot" who read mails & act for the user via API & sudo header Considering the security/spam issues brought up in the PR discussion it's probably best to do contribute to the PR and have one centralized implementation that is easier to maintain?

This is now implemented in gitea: https://github.com/go-gitea/gitea/pull/22056

However, the implementation seems a lot more complex than needed; gitea will pull emails via IMAP server, so aside from the SMTP server that receives email, an IMAP server is required to do the handoff, as well as proper storage to retain these mailboxes.

This is now implemented in gitea: https://github.com/go-gitea/gitea/pull/22056 However, the implementation seems a lot more complex than needed; gitea will pull emails via IMAP server, so aside from the SMTP server that receives email, an IMAP server is required to do the handoff, as well as proper storage to retain these mailboxes.
Member
Copy link

What part of that seems more complex than needed? If you use POP3 to receive emails without IMAP, you still need to store them on the POP3 server until the client picks them up. I suppose Gitea could listen on port 25 but that's a whole can of worms that is probably best left to a proper SMTP server.

What part of that seems more complex than needed? If you use POP3 to receive emails without IMAP, you still need to store them on the POP3 server until the client picks them up. I suppose Gitea could listen on port 25 but that's a whole can of worms that is probably best left to a proper SMTP server.

The simplest and most obvious approach is for SMTP/LMTP to deliver webhooks (or equivalent) to gitea directly.

Adding IMAP into the mix is odd. IMAP is for a server to store email to later be polled by a potentially unreachable client, so that the client can later query the mailbox. It doesn't make sense when you're pushing messages between servers. And you still need an SMTP and LMTP to deliver into the IMAP mailbox.

I'm not sure why you suggest POP3, it also seems like over-complicating things.

The simplest and most obvious approach is for SMTP/LMTP to deliver webhooks (or equivalent) to gitea directly. Adding IMAP into the mix is odd. IMAP is for a server to store email to later be polled by a potentially unreachable client, so that the client can later query the mailbox. It doesn't make sense when you're pushing messages between servers. And you still need an SMTP and LMTP to deliver into the IMAP mailbox. I'm not sure why you suggest POP3, it also seems like over-complicating things.
Member
Copy link

So you propose an API be added to Gitea to receive messages from an SMTP server in the form of a webhook? I've never seen an implementation like that. (削除) How do you configure the SMTP server to deliver the messages to that instead of a mailbox? (削除ここまで) Turns out Postfix can indeed be configured to pipe incoming messages to curl. Who knew?

I think the solution offered in Gitea is intended to be fairly easy to set up with an off-the-shelf mail account on whatever email serv(er|ice) you already have set up. As you mention, it does also have the advantage of still being able to collect messages if the Gitea server is down for some reason.

So you propose an API be added to Gitea to receive messages from an SMTP server in the form of a webhook? I've never seen an implementation like that. ~~How do you configure the SMTP server to deliver the messages to that instead of a mailbox?~~ Turns out Postfix can indeed be configured to pipe incoming messages to curl. Who knew? I think the solution offered in Gitea is intended to be fairly easy to set up with an off-the-shelf mail account on whatever email serv(er|ice) you already have set up. As you mention, it does also have the advantage of still being able to collect messages if the Gitea server is down for some reason.

Receiving via SMTP is what GitHub Enterprise does.

Receiving via LMTP is what Sourcehut does (although, to be fair, the SMTP server talks LMTP, which serves a similar role to "piping through curl).

SMTP servers keep the message around for 24/48hs if the destination is down, so if gitea/codeberg is down, they'd just retry delivery.

Receiving via SMTP is what GitHub Enterprise does. Receiving via LMTP is what Sourcehut does (although, to be fair, the SMTP server talks LMTP, which serves a similar role to "piping through curl). SMTP servers keep the message around for 24/48hs if the destination is down, so if gitea/codeberg is down, they'd just retry delivery.
Member
Copy link

Outgoing servers do that, but would the incoming server keep the message and retry piping it to curl if the first request failed?

Honestly I don't think it would be all that difficult to support this with an extension of the existing code, so it could probably be implemented.

P.S. It appears the way Gitea implemented it is quite similar to GitLab :)

Outgoing servers do that, but would the incoming server keep the message and retry piping it to curl if the first request failed? Honestly I don't think it would be all that difficult to support this with an extension of the existing code, so it could probably be implemented. P.S. It appears the way Gitea implemented it is quite similar to [GitLab](https://docs.gitlab.com/ee/administration/incoming_email.html) :)

There's no real distinction "incoming server" vs "outgoing server". They're all SMTP and behave the same.

Say you send an email from example@posteo.de. Your MUA will send the email to your local SMTP (often this first bit is skipped in modern setups), which them relays it to posteo's SMTP, which then relays it to the recipients SMTP, which then delivers it to a mailbox via LMTP (e.g.: the final SMTP server hands off the email to the IMAP server via LMTP usually).

All of these SMTP servers behave the same: they keep retrying or bounce the message if they can't deliver within 48hs (or maybe it was 24hs?).

In this case, you'd be able to replace "deliver via LMTP to an IMAP mailbox" with "deliver via LMTP to something that sends webhooks". I suppose that "pipe via curl" is basically a less-standard way of doing LMTP, but should work all the same.

There's no real distinction "incoming server" vs "outgoing server". They're all SMTP and behave the same. Say you send an email from example@posteo.de. Your MUA will send the email to your local SMTP (often this first bit is skipped in modern setups), which them relays it to posteo's SMTP, which then relays it to the recipients SMTP, which then delivers it to a mailbox via LMTP (e.g.: the final SMTP server hands off the email to the IMAP server via LMTP usually). All of these SMTP servers behave the same: they keep retrying or bounce the message if they can't deliver within 48hs (or maybe it was 24hs?). In this case, you'd be able to replace "deliver via LMTP to an IMAP mailbox" with "deliver via LMTP to something that sends webhooks". I suppose that "pipe via curl" is basically a less-standard way of doing LMTP, but should work all the same.
Member
Copy link

Sorry, maybe I'm not communicating adequately. I am not concerned about the message being dropped, I am concerned about the SMTP server successfully receiving the message and piping it to curl, only for that operation to fail because the Gitea server is down.

From the perspective of an average system administrator, this does seem a lot more difficult to understand than simply pointing Gitea at an IMAP account.

Sorry, maybe I'm not communicating adequately. I am not concerned about the message being dropped, I am concerned about the SMTP server successfully receiving the message and piping it to curl, only for that operation to fail because the Gitea server is down. From the perspective of an average system administrator, this does seem a lot more difficult to understand than simply pointing Gitea at an IMAP account.

FWIW There is a development for this functionality at https://codeberg.org/Codeberg-Infrastructure/email-service but no progress since the Hackaton v2 where there was a team working on it.

FWIW There is a development for this functionality at https://codeberg.org/Codeberg-Infrastructure/email-service but no progress since the Hackaton v2 where there was a team working on it.

Since this is now released in gitea, what are the obstacles to put this in place for Codeberg ?

Since this is now released in gitea, what are the obstacles to put this in place for Codeberg ?

Thank you very much for reminding us about this; this feature is disabled in Gitea by default and someone has to enable it.

https://github.com/go-gitea/gitea/pull/22056/files#diff-eda333ab2034231553808ef0f99e28cd1f209c7f583fd3d0aa0fb1b77e573cd4

Thank you very much for reminding us about this; this feature is disabled in Gitea by default and someone has to enable it. https://github.com/go-gitea/gitea/pull/22056/files#diff-eda333ab2034231553808ef0f99e28cd1f209c7f583fd3d0aa0fb1b77e573cd4

Hey, any updates on this? It's very useful to read and reply to comments directly from my e-mail client :)

Hey, any updates on this? It's very useful to read and reply to comments directly from my e-mail client :)
Owner
Copy link

This is currently tracked in #1562#

This is currently tracked in https://codeberg.org/Codeberg/Community/issues/1562#
Sign in to join this conversation.
No Branch/Tag specified
main
No results found.
Labels
Clear labels
accessibility

Reduces accessibility and is thus a "bug" for certain user groups on Codeberg.
bug

Something is not working the way it should. Does not concern outages.
bug
infrastructure

Errors evidently caused by infrastructure malfunctions or outages
Codeberg

This issue involves Codeberg's downstream modifications and settings and/or Codeberg's structures.
contributions welcome

Please join the discussion and consider contributing a PR!
docs

No bug, but an improvement to the docs or UI description will help
duplicate

This issue or pull request already exists
enhancement

New feature
infrastructure

Involves changes to the server setups, use `bug/infrastructure` for infrastructure-related user errors.
legal

An issue directly involving legal compliance
licence / ToS

involving questions about the ToS, especially licencing compliance
please chill
we are volunteers

Please consider editing your posts and remember that there is a human on the other side. We get that you are frustrated, but it's harder for us to help you this way.
public relations

Things related to Codeberg's external communication
question

More information is needed
question
user support

This issue contains a clearly stated problem. However, it is not clear whether we have to fix anything on Codeberg's end, but we're helping them fix it and/or find the cause.
s/Forgejo

Related to Forgejo. Please also check Forgejo's issue tracker.
s/Forgejo/migration

Migration related issues in Forgejo
s/Pages

Issues related to the Codeberg Pages feature
s/Weblate

Issue is related to the Weblate instance at https://translate.codeberg.org
s/Woodpecker

Woodpecker CI related issue
security

involves improvements to the sites security
service

Add a new service to the Codeberg ecosystem (instead of implementing into Gitea)
upstream

An open issue or pull request to an upstream repository to fix this issue (partially or completely) exists (i.e. Gitea, Forgejo, etc.)
wontfix

Codeberg's current set of contributors are not planning to spend time on delegating this issue.
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
10 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Codeberg/Community#372
Reference in a new issue
Codeberg/Community
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?