mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
FIX: use MD5 of the email_string when there's no 'Message-Id'
This commit is contained in:
parent
1ba65765e4
commit
4a3cb4a000
5 changed files with 13 additions and 20 deletions
|
@ -1,3 +1,4 @@
|
|||
require "digest"
|
||||
require_dependency "new_post_manager"
|
||||
require_dependency "post_action_creator"
|
||||
require_dependency "email/html_cleaner"
|
||||
|
@ -9,7 +10,6 @@ module Email
|
|||
|
||||
class ProcessingError < StandardError; end
|
||||
class EmptyEmailError < ProcessingError; end
|
||||
class NoMessageIdError < ProcessingError; end
|
||||
class AutoGeneratedEmailError < ProcessingError; end
|
||||
class NoBodyDetectedError < ProcessingError; end
|
||||
class InactiveUserError < ProcessingError; end
|
||||
|
@ -29,7 +29,7 @@ module Email
|
|||
raise EmptyEmailError if mail_string.blank?
|
||||
@raw_email = mail_string
|
||||
@mail = Mail.new(@raw_email)
|
||||
raise NoMessageIdError if @mail.message_id.blank?
|
||||
@message_id = @mail.message_id.presence || Digest::MD5.hexdigest(mail_string)
|
||||
end
|
||||
|
||||
def process!
|
||||
|
@ -42,7 +42,7 @@ module Email
|
|||
end
|
||||
|
||||
def find_or_create_incoming_email
|
||||
IncomingEmail.find_or_create_by(message_id: @mail.message_id) do |ie|
|
||||
IncomingEmail.find_or_create_by(message_id: @message_id) do |ie|
|
||||
ie.raw = @raw_email
|
||||
ie.subject = subject
|
||||
ie.from_address = @from_email
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue