Class: Goodmail::EmailParts

Inherits:
Struct
  • Object
show all
Defined in:
lib/goodmail/email.rb

Overview

Simple struct to hold the rendered HTML and text parts of an email, plus any attachments collected via the ‘attach` / `inline_image` DSL helpers. Custom Action Mailer classes can call Goodmail’s auto-installed ‘goodmail_mail_parts(parts, headers)` helper to apply attachments, pin inline Content-IDs, add unsubscribe headers, and send the multipart body.

‘attachments` defaults to `[]` for backwards compatibility — callers written against 0.3.x keep working unchanged.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(html: nil, text: nil, attachments: []) ⇒ EmailParts

Returns a new instance of EmailParts.



15
16
17
# File 'lib/goodmail/email.rb', line 15

def initialize(html: nil, text: nil, attachments: [])
  super(html: html, text: text, attachments: attachments || [])
end

Instance Attribute Details

#attachmentsObject

Returns the value of attribute attachments

Returns:

  • (Object)

    the current value of attachments



14
15
16
# File 'lib/goodmail/email.rb', line 14

def attachments
  @attachments
end

#htmlObject

Returns the value of attribute html

Returns:

  • (Object)

    the current value of html



14
15
16
# File 'lib/goodmail/email.rb', line 14

def html
  @html
end

#textObject

Returns the value of attribute text

Returns:

  • (Object)

    the current value of text



14
15
16
# File 'lib/goodmail/email.rb', line 14

def text
  @text
end