-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
reply issue by email #13585
Closed
Closed
reply issue by email #13585
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
404ae49
reply issue by email
a1012112796 61b9c64
fix vendor
a1012112796 539421d
Merge branch 'master' into imap
a1012112796 ca8a716
fix charsets
a1012112796 30d3479
Merge branch 'master' into imap
a1012112796 d5dac5d
Merge branch 'master' into imap
a1012112796 c95f015
simplify logic
a1012112796 e357517
Merge branch 'master' into imap
a1012112796 e6ada29
fix test
a1012112796 4800de2
Merge branch 'master' into imap
a1012112796 5b5fb6c
Merge branch 'master' into imap
a1012112796 77cedeb
Merge branch 'master' into imap
a1012112796 074e6d2
translate
a1012112796 4baedb5
Merge branch 'master' into imap
a1012112796 08345f0
add missing config example
a1012112796 560f48a
Merge branch 'master' into imap
a1012112796 f30caf9
test code 1 and fix some logic
a1012112796 f076123
Merge branch 'master' into imap
a1012112796 b00df2e
lint
a1012112796 47df1c9
fix bug
a1012112796 2923155
Merge branch 'main' into imap
a1012112796 4176a92
fix bug
a1012112796 e881e4c
Merge branch 'main' into imap
a1012112796 cffb646
apply suggestions from code review
a1012112796 99921b3
Merge branch 'main' into imap
a1012112796 65c26ca
fix lint
a1012112796 68c69bb
Merge branch 'main' into imap
a1012112796 4069ceb
fix ci and remove test code before finish it
a1012112796 3cfe21e
Merge branch 'main' into imap
a1012112796 325392e
upgrade go-imap v1.0.6 -> v1.2.0
a1012112796 5589c19
fix lint
a1012112796 e1948eb
Merge branch 'main' into imap
a1012112796 fe2f5e6
test code 1
a1012112796 9670bc1
fmt
a1012112796 0fc7000
Merge branch 'main' into imap
a1012112796 f0d9b54
fix lint
a1012112796 0bad64a
Merge branch 'main' into imap
a1012112796 bbb2513
remove not passd test before fix
a1012112796 af5a825
fmt
a1012112796 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,6 @@ | |
created_unix: 946684810 | ||
updated_unix: 978307190 | ||
|
||
|
||
- | ||
id: 3 | ||
repo_id: 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2021 The Gitea Authors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package setting | ||
|
||
import "code.gitea.io/gitea/modules/log" | ||
|
||
// MailReceiver represents mail receive service. | ||
type MailReceiver struct { | ||
ReceiveEmail string | ||
ReceiveBox string | ||
QueueLength int | ||
Host string | ||
User, Passwd string | ||
IsTLSEnabled bool | ||
DeleteReadMail bool | ||
} | ||
|
||
var ( | ||
// MailRecieveService mail receive config | ||
MailRecieveService *MailReceiver | ||
) | ||
|
||
func newMailRecieveService() { | ||
sec := Cfg.Section("mail_receive") | ||
// Check mailer setting. | ||
if !sec.Key("ENABLED").MustBool() { | ||
return | ||
} | ||
|
||
MailRecieveService = &MailReceiver{ | ||
ReceiveEmail: sec.Key("RECEIVE_EMAIL").String(), | ||
ReceiveBox: sec.Key("RECEIVE_BOX").MustString("INBOX"), | ||
QueueLength: sec.Key("READ_BUFFER_LEN").MustInt(100), | ||
Host: sec.Key("HOST").String(), | ||
User: sec.Key("USER").String(), | ||
Passwd: sec.Key("PASSWD").String(), | ||
IsTLSEnabled: sec.Key("IS_TLS_ENABLED").MustBool(true), | ||
DeleteReadMail: sec.Key("DELETE_READ_MAIL").MustBool(false), | ||
} | ||
|
||
log.Info("Mail Receive Service Enabled") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2021 The Gitea Authors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package imap | ||
|
||
import ( | ||
"code.gitea.io/gitea/modules/setting" | ||
) | ||
|
||
var ( | ||
c *Client | ||
) | ||
|
||
// FetchAllUnreadMails fetch all unread mails | ||
func FetchAllUnreadMails() (err error) { | ||
if c == nil { | ||
c, err = NewImapClient(ClientInitOpt{ | ||
Addr: setting.MailRecieveService.Host, | ||
UserName: setting.MailRecieveService.User, | ||
Passwd: setting.MailRecieveService.Passwd, | ||
IsTLS: setting.MailRecieveService.IsTLSEnabled, | ||
}) | ||
if err != nil { | ||
return | ||
} | ||
} | ||
|
||
if mailReadQueue != nil && !mailReadQueue.IsEmpty() { | ||
return | ||
} | ||
|
||
mails, err := c.GetUnreadMails(setting.MailRecieveService.ReceiveBox, 100) | ||
if err != nil { | ||
return | ||
} | ||
|
||
for _, mail := range mails { | ||
err = mailReadQueue.Push(mail) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
|
||
return nil | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
As above, these Message-ID should follow RFC encoding