mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 13:56:50 +08:00
3246c3cc92
Version 2.8 brings some changes to how address fields are handled and this commits updates that and should also include a fix which handles encoded attachment filenames. The fork contains a bugfix to correctly decode mail attachments.
29 lines
1.0 KiB
Ruby
29 lines
1.0 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
class MockedImapProvider < Imap::Providers::Gmail
|
|
def connect!; end
|
|
def disconnect!; end
|
|
def open_mailbox(mailbox_name, write: false); end
|
|
|
|
def labels
|
|
['INBOX']
|
|
end
|
|
end
|
|
|
|
def EmailFabricator(options)
|
|
email = +''
|
|
email += "Date: Sat, 31 Mar 2018 17:50:19 -0700\n"
|
|
email += "From: #{options[:from] || "Dan <dan@discourse.org>"}\n"
|
|
email += "To: #{options[:to] || "Joffrey <joffrey@discourse.org>"}\n"
|
|
email += "Cc: #{options[:cc]}\n" if options[:cc]
|
|
email += "In-Reply-To: #{options[:in_reply_to]}\n" if options[:in_reply_to]
|
|
email += "References: #{options[:in_reply_to]}\n" if options[:in_reply_to]
|
|
email += "Message-ID: <#{options[:message_id]}>\n" if options[:message_id]
|
|
email += "Subject: #{options[:subject] || "This is a test email subhect"}\n"
|
|
email += "Mime-Version: 1.0\n"
|
|
email += "Content-Type: #{options[:content_type] || "text/plain;\n charset=UTF-8"}\n"
|
|
email += "Content-Transfer-Encoding: 7bit\n"
|
|
email += "\n#{options[:body] || "This is an email *body*. :smile:"}"
|
|
email
|
|
end
|