Content

public struct Content : Encodable

The Content class represents a MIME part of the email message (i.e. the plain text and HTML parts of an email).

  • The content type of the content.

    Declaration

    Swift

    public let type: ContentType
  • The value of the content.

    Declaration

    Swift

    public let value: String
  • Initializes the content with a content type and value.

    Declaration

    Swift

    public init(contentType: ContentType, value aValue: String)

    Parameters

    contentType

    The content type.

    aValue

    The value of the content.

  • Validates the content.

    Declaration

    Swift

    public func validate() throws
  • Creates a new Content instance used to represent a plain text body.

    Declaration

    Swift

    public static func plainText(body value: String) -> Content

    Parameters

    value

    The plain text value of the body.

    Return Value

    A Content instance with the text/plain content type.

  • Creates a new Content instance used to represent an HTML body.

    Declaration

    Swift

    public static func html(body value: String) -> Content

    Parameters

    value

    The HTML text value of the body.

    Return Value

    A Content instance with the text/html content type.

  • Return an array containing a plain text and html body.

    Declaration

    Swift

    public static func emailBody(plain: String, html: String) -> [Content]

    Parameters

    plain

    The text value for the plain text body.

    html

    The HTML text value for the HTML body.

    Return Value

    An array of Content instances.