-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Sendmail command #13079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sendmail command #13079
Conversation
Usefull to have when you need to be confident that message was sent.
Codecov Report
@@ Coverage Diff @@
## master #13079 +/- ##
==========================================
+ Coverage 42.05% 42.12% +0.07%
==========================================
Files 681 687 +6
Lines 75121 75632 +511
==========================================
+ Hits 31594 31862 +268
- Misses 38372 38547 +175
- Partials 5155 5223 +68
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!! Thanks so much for the PR :) We ❤️ new contributors.
A couple of bits of feedback:
- Could you split this off into a separate file (admin.go is getting a bit long at this point), perhaps cmd/mailer.go?
- Can you add checks that if either title or content is empty then error out?
- Could you add a confirmation step (and perhaps a
--force
flag to bypass confirmation) so that emails don't accidentally get sent out.
Thank you for your message @techknowlogick. According to your second point I could image that content/body may be empty what do you think? |
Perhaps you could add a warning when user is asked to confirm they want to send mail when subject or content is empty instead of my original suggestion of stopping send mail? |
Print waring if it's empty or haven't been set up. The warning will be skiped if there's a `--force` flag.
Just to notice if |
Co-authored-by: 6543 <[email protected]>
IterateUsers uses batching by default. Signed-off-by: Maxim Zhiburt <[email protected]>
Signed-off-by: Maxim Zhiburt <[email protected]>
Signed-off-by: Maxim Zhiburt <[email protected]>
Sorry to jump in so late. We need to decide what type of command this is. If it is intended to communicate with a running Gitea we should create and use an internal api to call and communicate with the running server. If, as it appears, it is intended not to communicate with a running Gitea you could have used the already available Async methods and just ran flush queues at the end of it. |
Signed-off-by: Maxim Zhiburt <[email protected]>
Signed-off-by: Maxim Zhiburt <[email protected]>
Thanks for the hint over
We could support 2 types of calls probably, which could be determined by a flag. |
Signed-off-by: Maxim Zhiburt <[email protected]>
I've started looking at the API and as I see to use an API as an admin we need to authenticate yourself right? And why actually you consider here it's appropriate to be attached to a running Gitea where others admin commands doesn't what is the benefit? And if we expose such API in my opinion it just make more sense to provide a page with a form for this purpose and that is it. |
Co-authored-by: 6543 <[email protected]>
If the configuration sets the mailer queue as levelqueue, the command will fail when start, except queue is a network service. |
Thanks for the clarification. So I've updated the PR to use a private API |
🚀 |
…s-stored-in-email-address-table * origin/master: [UI] Hide consecutive additions and removals of the same label (go-gitea#13315) [skip ci] Updated translations via Crowdin Fix send mail (go-gitea#13312) [skip ci] Updated translations via Crowdin Deny wrong pull (go-gitea#13308) Group Label Changed Comments in timeline (go-gitea#13304) [skip ci] Updated translations via Crowdin Attempt to handle unready PR in tests (go-gitea#13305) go-gitea#12897 - add mastodon provider (go-gitea#13293) [skip ci] Updated translations via Crowdin Fix Storage mapping (go-gitea#13297) Update Mirror IsEmpty status on synchronize (go-gitea#13185) Fix bug isEnd detection on getIssues/getPullRequests (go-gitea#13299) systemd service: Add commented PATH environment option for Git prefix (go-gitea#13170) Sendmail command (go-gitea#13079) Various UI and arc-green fixes (go-gitea#13291)
Implements a
sendmail
command which sends a message to all users that are present in db.Tented to close #12996
I am not versed in a code base so there may be some issues 😞 .
Thank you.