feat: better handling of oversized mails, and add junk option
This commit is contained in:
@@ -266,7 +266,7 @@ func (ic *IMAPClient) SaveDraft(email Email, response string) (err error) {
|
||||
email.From,
|
||||
email.Subject,
|
||||
email.Date.Format("Mon, 02 Jan 2006 15:04:05 -0700"),
|
||||
extractMessageContent(email.Body))
|
||||
ExtractMessageContent(email.Body))
|
||||
|
||||
literal := &MessageLiteral{
|
||||
content: []byte(draft),
|
||||
@@ -287,9 +287,9 @@ func (ic *IMAPClient) SaveDraft(email Email, response string) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// extractMessageContent attempts to extract just the message content
|
||||
// ExtractMessageContent attempts to extract just the message content
|
||||
// by removing email headers and MIME boundaries
|
||||
func extractMessageContent(body string) string {
|
||||
func ExtractMessageContent(body string) string {
|
||||
logger.WithField("bodyLength", len(body)).Debug("Starting message content extraction")
|
||||
logger.WithField("rawInputBody", body).Debug("extractMessageContent: Raw input body")
|
||||
msg, err := mail.ReadMessage(strings.NewReader(body))
|
||||
|
||||
Reference in New Issue
Block a user