class Mail::ToField

Overview

= To Field

The To field inherits to StructuredField and handles the To: header field in the email.

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

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

== Examples:

mail = Mail.new mail.to = 'Mikel Lindsaar [email protected], [email protected]' mail.to #=> ['[email protected]', '[email protected]'] mail[:to] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ToField:0x180e1c4 mail['to'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ToField:0x180e1c4 mail['To'] #=> '#<Mail::Field:0x180e5e8 @field=#<Mail::ToField:0x180e1c4

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

Defined in:

mail/fields/to_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]