Module: Email
- Defined in:
- lib/email/styles.rb,
lib/email.rb,
lib/email/poller.rb,
lib/email/sender.rb,
lib/email/cleaner.rb,
lib/email/receiver.rb,
lib/email/renderer.rb,
lib/email/processor.rb,
lib/email/validator.rb,
lib/email/message_builder.rb,
lib/email/build_email_helper.rb,
lib/email/message_id_service.rb,
lib/email/authentication_results.rb
Overview
Builds a Mail::Message we can use for sending. Optionally supports using a template for the body and subject
Defined Under Namespace
Modules: BuildEmailHelper
Classes: AuthenticationResults, Cleaner, MessageBuilder, MessageIdService, Poller, Processor, Receiver, Renderer, Sender, Styles, Validator
Constant Summary
collapse
- SMTP_STATUS_SUCCESS =
"2."
- SMTP_STATUS_TRANSIENT_FAILURE =
"4."
- SMTP_STATUS_PERMANENT_FAILURE =
"5."
Class Method Summary
collapse
Class Method Details
.cleanup_alias(name) ⇒ Object
35
36
37
|
# File 'lib/email.rb', line 35
def self.cleanup_alias(name)
name ? name.gsub(/[:<>,"]/, "") : name
end
|
.downcase(email) ⇒ Object
16
17
18
19
|
# File 'lib/email.rb', line 16
def self.downcase(email)
return email unless Email.is_valid?(email)
email.downcase
end
|
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/email.rb', line 39
def self.(raw)
mail = Mail.new(raw)
text = nil
html = nil
if mail.multipart?
text = mail.text_part
html = mail.html_part
elsif mail.content_type.to_s["text/html"]
html = mail
else
text = mail
end
[text&.decoded, html&.decoded]
end
|
.is_valid?(email) ⇒ Boolean
.obfuscate(email) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/email.rb', line 21
def self.obfuscate(email)
return email if !Email.is_valid?(email)
first, _, last = email.rpartition("@")
last = last.split(".")
tld = last.pop
last.map! { |part| obfuscate_part(part) }
last << tld
"#{obfuscate_part(first)}@#{last.join(".")}"
end
|
.site_title ⇒ Object
56
57
58
|
# File 'lib/email.rb', line 56
def self.site_title
SiteSetting.email_site_title.presence || SiteSetting.title
end
|