What is This Library NOT?

This library does NOT provide functions to compose internet mails. You must
create them by yourself. If you want better mail support, try RubyMail or
TMail. You can get both libraries from RAA. (http://www.ruby-lang.org/en/raa.html)

Examples

Sending Messages

You must open a connection to an SMTP server before sending messages. The
first argument is the address of your SMTP server, and the second argument
is the port number. Using SMTP.start with a block is the simplest way to do
this. This way, the SMTP connection is closed automatically after the block
is executed.

require'net/smtp'Net::SMTP.start('your.smtp.server',25)do|smtp|# Use the SMTP object smtp only in this block.end

You can also use the block form of SMTP.start/SMTP#start. This closes the
SMTP session automatically:

# using block form of SMTP.startNet::SMTP.start('your.smtp.server',25)do|smtp|smtp.send_messagemsgstr,'from@address','to@address'end

I strongly recommend this scheme. This form is simpler and more robust.

HELO domain

In almost all situations, you must provide a third argument to
SMTP.start/SMTP#start. This is the domain name which you are on (the host
to send mail from). It is called the "HELO domain". The SMTP
server will judge whether it should send or reject the SMTP session by
inspecting the HELO domain.