class Mail::FromField

Overview

= From Field

The From field inherits from StructuredField and handles the From: header field in the email.

Sending from to a mail message will instantiate a Mail::Field object that has a FromField as its field type. This includes all Mail::CommonAddress module instance metods.

Only one From field can appear in a header, though it can have multiple addresses and groups of addresses.

== Examples:

mail = Mail.new mail.from = 'Mikel Lindsaar [email protected], [email protected]' mail.from #=> ['[email protected]', '[email protected]'] mail[:from] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::FromField:0x180e1c4 mail['from'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::FromField:0x180e1c4 mail['From'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::FromField:0x180e1c4

mail[:from].encoded #=> 'from: Mikel Lindsaar [email protected], [email protected]\r\n' mail[:from].decoded #=> 'Mikel Lindsaar [email protected], [email protected]' mail[:from].addresses #=> ['[email protected]', '[email protected]'] mail[:from].formatted #=> ['Mikel Lindsaar [email protected]', '[email protected]']

Defined in:

mail/fields/from_field.cr

Class Method Summary

Instance methods inherited from class Mail::CommonAddressField

<<(val) <<, address address, addresses addresses, addrs addrs, decoded_group_addresses decoded_group_addresses, default default, display_names display_names, do_decode do_decode, do_encode do_encode, each(&) each, element element, encode_if_needed(val, val_charset = charset) encode_if_needed, encoded_group_addresses encoded_group_addresses, formatted formatted, get_group_addresses(group_list) get_group_addresses, group_addresses group_addresses, group_names group_names, groups groups, utf8_if_needed(val, val_charset) utf8_if_needed

Constructor methods inherited from class Mail::CommonAddressField

new(value = nil, charset = nil) new

Class methods inherited from class Mail::CommonAddressField

singular? singular?

Constructor methods inherited from class Mail::NamedStructuredField

new(value = nil, charset = nil) new

Instance methods inherited from class Mail::CommonField

charset : String | Nil charset, charset=(charset : String | Nil) charset=, decoded decoded, default default, do_decode do_decode, do_encode do_encode, element element, element=(element) element=, encoded encoded, errors : Array(Array(Mail::Field::ParseError | String)) errors, errors=(errors : Array(Array(String | Field::ParseError))) errors=, main_type main_type, mime_type mime_type, name : String | Nil name, name=(name : String | Nil) name=, parameters parameters, parse parse, responsible_for?(field_name) responsible_for?, singular? singular?, to_s to_s, value : String | Nil value, value=(value) value=

Constructor methods inherited from class Mail::CommonField

new(value = nil, charset = nil) new

Class methods inherited from class Mail::CommonField

parse(*args) parse, singular? singular?

Class Method Detail

def self.field_name : String #

[View source]