2020-07-10 05:05:55 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class MockedImapProvider < Imap::Providers::Gmail
|
|
|
|
def connect!
|
|
|
|
end
|
2023-12-15 10:46:04 -05:00
|
|
|
|
2020-07-10 05:05:55 -04:00
|
|
|
def disconnect!
|
|
|
|
end
|
2023-12-15 10:46:04 -05:00
|
|
|
|
2020-07-10 05:05:55 -04:00
|
|
|
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]
|
2021-02-18 13:15:02 -05:00
|
|
|
email += "Message-ID: <#{options[:message_id]}>\n" if options[:message_id]
|
2021-05-20 21:43:47 -04:00
|
|
|
email += "Subject: #{options[:subject] || "This is a test email subject"}\n"
|
2020-07-10 05:05:55 -04:00
|
|
|
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
|