# Mail services reference

Mail

The `Mail` class is a mail delivery object which manages to contact a Mail Transport Agent or MTA in order to deliver a message to one or several recipients. By default, the object contacts the local MTA, but this behavior can be changed with the `set-mta-address` method. The class implements the recipient an address syntax scheme as specified by RFC822. At construction, the instance is empty. Only the recipient address needs to be specified. The `send` method send the message by contacting the MTA. If an error occurs, an exception is raised.

mail-p
Object
Mail
none

The `Mail` constructor create a a default message which is empty. The recipient addresses and the subject must be specified for a successful message delivery.

to
none
String

The `to` method adds one or several address to the destination list. The address format must conform to RFC822. Multiple address are coma separated. Multiple call to this method is possible.

cc
none
String

The `cc` method adds one or several address to the copy list. The address format must conform to RFC822. Multiple address are coma separated. Multiple call to this method is possible.

bcc
none
String

The `bcc` method adds one or several address to the blind copy list. The address format must conform to RFC822. Multiple address are coma separated. Multiple call to this method is possible. The blind copy list is not included in the message header.

add
none
String ...

The `add` method adds one or several literals to the message buffer. This is the normal way to fill a message buffer by string line.

addln
none
String ...

The `addln` method adds one or several literals to the message buffer. A newline character is added at the end of the line. This is a similar way to fill a message buffer by string line.

send
none
none

The `send` method request a message delivery by contacting the MTA. Once the MTA has been contacted, the message header and the message body is transferred. The MTA is responsible to deliver the message to the appropriate recipients.

subject
none
String

The `subject` method sets the message subject string line.

set-mta-address
none
String

The `set-mta-address` method sets the MTA IP address that the class needs to contact for mail request. The address can be an fully qualified host name or an IP number.

get-mta-address
String
none

The `get-mta-address` method returns the current MTA IP address for this mail object.

set-mta-port
none
Integer

The `set-mta-port` method set the current MTA IP port number for this mail object. With the MTA IP address, the MTA to contact for mail request is uniquely defined. The default port value is 25.

get-mta-port
Integer
none

The `get-mta-port` method returns the current MTA IP port number for this mail object. The default port value is 25.