TMail::Mail class

Super Class

Object

Class Methods

new( arg ) : TMail
This method creates new TMail object.
"arg" is an instance of Port.
loadfrom( filename ) : TMail
This method creates a TMail object. "filename" is name of file which contain only one mail (e.g. Mh mail file).
boundary
return new "boundary" at random.
msgid
return new "message ID". If TMail can get host name, string is "", else ""
I do not recommend to use this method.
quote( str )
quote string if it is not mail-safe
quote_phrase( str )
quote phrase string if it is not mail-safe (for phrase)

Method

date( default = nil ), date=( time )
time in 'Date' header field
to( default = '' ), to=( str )
the first 'To' address
from( default = '' ), from=( str )
the first 'From' address
from_phrase( default = '' ): String
return a phrase of the first 'From' address. If there's no 'From' header, return arg 'default'.
subject( default = '' ), subject=( str )
body of 'Subject'
msgid( default = '' ), msgid=( str )n
'Message-Id' string
main_type( default = nil )
main content-type.
sub_type( default = nil )
sub content-type.
charset( default = nil ), charset=( str )
charset parameter in content-type header.
set_content_type( main: String, sub: String, param: Hash = nil )
set 'Content-type' header as "main/sub; param=val; param=val; ...".
encoding( default = nil ), encoding=( str )n
the body of 'Content-Transfer-Encoding'.
destinations
all the addresses in 'To', 'Cc', 'Bcc'. return value is Array of String.
each_dest{|addr| ....}
iterate for each destination. 'addr' is address (format is "...@...")
clear
clear all header.
each_key{|header_name| .....}
iterate for each header name.
keys
return an array of header name.
self[ key ]
return a header field object by header name. ex: tmail[ 'To' ]
self[ key ]= val
This method set a header object as a content of 'key' header.
delete( key )
delete 'key' header.
delete_if {|key, val| .... }
This method evaluates block with a name of header and header field object, and if true delete the header.
each {|key, val| .... }
each_pair {|key, val| .... }
iteration for each header name and its field object.
each_value {|val| .... }
iteration for each header field object.
fetch( key, default_body = nil )
fetch( key ) { .... }
return header field object for 'key' header. Some header returns an array of header field object (ex: Received).

In case there's no 'key' header, execute "add_header(key,default_body)" and return its header object. In case 'default_body' is nil and also there's no block was given use its return value as 'default_body'.

has_key?( key )
include?( key )
key?( key )
true if the mail has 'key' header
has_value?( val )
value?( val )
If the mail has 'val' header field object, return true.
indexes( *keys )
indices( *keys )
"keys.collect{|i| fetch(i)}"
store( key, val )
set a header object as content of 'key' header. "val" must be a HeaderField or String.
values
an array of all header field object.
body
preamble
the mail body. If the mail was MIME multipart mail, this represent 'preamble'.
parts
If the mail was MIME multipart mail, each element is TMail::Mail object which represents MIME part. If not, this is an empty array.
epilogue
If the mail was MIME multipart mail, this represent 'epilogue' string. Else, void string.
multipart?
True if it is MIME multipart mail.
to_s( eol = "\n", header_sep = '' )
convert it to a string.
If there's ESC in header, TMail encode the header (only 'B' encode can be used).

'header_sep' is separator of header and body. ex: '----' for Mh mail.

inspect( eol = "\n", header_sep = '' )
convert it to a string. This method is equal to 'to_s' except 'inspect' does not encode header.

Copyright (c) 1998-2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>