Repository URL to install this package:
|
Version:
2.2.2-1 ▾
|
U:RDoc::NormalClass[iI" SMTP:EFI"Net::SMTP;FI"Object;To:RDoc::Markup::Document:@parts[o;;[/S:RDoc::Markup::Heading:
leveli: textI"What is This Library?;To:RDoc::Markup::BlankLine o:RDoc::Markup::Paragraph;[I":This library provides functionality to send internet ;TI"Fmail via SMTP, the Simple Mail Transfer Protocol. For details of ;TI"FSMTP itself, see [RFC2821] (http://www.ietf.org/rfc/rfc2821.txt).;T@S; ;
i;I"What is This Library NOT?;T@o;
;[
I"HThis library does NOT provide functions to compose internet mails. ;TI"HYou must create them by yourself. If you want better mail support, ;TI"9try RubyMail or TMail or search for alternatives in ;TI"8{RubyGems.org}[https://rubygems.org/] or {The Ruby ;TI"-Toolbox}[https://www.ruby-toolbox.com/].;T@o;
;[I"jFYI: the official documentation on internet mail is: [RFC2822] (http://www.ietf.org/rfc/rfc2822.txt).;T@S; ;
i;I"
Examples;T@S; ;
i;I"Sending Messages;T@o;
;[
I"KYou must open a connection to an SMTP server before sending messages. ;TI"KThe first argument is the address of your SMTP server, and the second ;TI"Pargument is the port number. Using SMTP.start with a block is the simplest ;TI"Kway to do this. This way, the SMTP connection is closed automatically ;TI"!after the block is executed.;T@o:RDoc::Markup::Verbatim;[ I"require 'net/smtp'
;TI"7Net::SMTP.start('your.smtp.server', 25) do |smtp|
;TI"6 # Use the SMTP object smtp only in this block.
;TI" end
;T:@format0o;
;[I"@Replace 'your.smtp.server' with your SMTP server. Normally ;TI"@your system manager or internet provider supplies a server ;TI"
for you.;T@o;
;[I" Then you can send messages.;T@o;;[I"msgstr = <<END_OF_MESSAGE
;TI")From: Your Name <your@mail.address>
;TI"3To: Destination Address <someone@example.com>
;TI"Subject: test message
;TI"+Date: Sat, 23 Jun 2001 16:26:43 +0900
;TI"8Message-Id: <unique.message.id.string@example.com>
;TI"
;TI"This is a test message.
;TI"END_OF_MESSAGE
;TI"
;TI"require 'net/smtp'
;TI"7Net::SMTP.start('your.smtp.server', 25) do |smtp|
;TI"! smtp.send_message msgstr,
;TI". 'your@mail.address',
;TI"3 'his_address@example.com'
;TI" end
;T;0S; ;
i;I"Closing the Session;T@o;
;[I"HYou MUST close the SMTP session after sending messages, by calling ;TI"the #finish method:;T@o;;[ I"# using SMTP#finish
;TI"4smtp = Net::SMTP.start('your.smtp.server', 25)
;TI"<smtp.send_message msgstr, 'from@address', 'to@address'
;TI"smtp.finish
;T;0o;
;[I"LYou can also use the block form of SMTP.start/SMTP#start. This closes ;TI"$the SMTP session automatically:;T@o;;[ I"&# using block form of SMTP.start
;TI"7Net::SMTP.start('your.smtp.server', 25) do |smtp|
;TI"> smtp.send_message msgstr, 'from@address', 'to@address'
;TI" end
;T;0o;
;[I"MI strongly recommend this scheme. This form is simpler and more robust.;T@S; ;
i;I"HELO domain;T@o;
;[
I"AIn almost all situations, you must provide a third argument ;TI"Hto SMTP.start/SMTP#start. This is the domain name which you are on ;TI"C(the host to send mail from). It is called the "HELO domain". ;TI"AThe SMTP server will judge whether it should send or reject ;TI"4the SMTP session by inspecting the HELO domain.;T@o;;[I"-Net::SMTP.start('your.smtp.server', 25,
;TI"8 'mail.from.domain') { |smtp| ... }
;T;0S; ;
i;I"SMTP Authentication;T@o;
;[ I"@The Net::SMTP class supports three authentication schemes; ;TI"BPLAIN, LOGIN and CRAM MD5. (SMTP Authentication: [RFC2554]) ;TI"9To use SMTP authentication, pass extra arguments to ;TI"SMTP.start/SMTP#start.;T@o;;[I"
# PLAIN
;TI"ANet::SMTP.start('your.smtp.server', 25, 'mail.from.domain',
;TI"> 'Your Account', 'Your Password', :plain)
;TI"
# LOGIN
;TI"ANet::SMTP.start('your.smtp.server', 25, 'mail.from.domain',
;TI"> 'Your Account', 'Your Password', :login)
;TI"
;TI"# CRAM MD5
;TI"ANet::SMTP.start('your.smtp.server', 25, 'mail.from.domain',
;TI"@ 'Your Account', 'Your Password', :cram_md5);T;0:
@fileI"lib/net/smtp.rb;T:0@omit_headings_from_table_of_contents_below0;0;0[[
I"address;TI"R;T:publicFI"lib/net/smtp.rb;T[
I"
esmtp;TI"RW;T;F@[
I"esmtp?;TI"RW;T;F@[
I"open_timeout;TI"RW;T;F@[
I" port;TI"R;T;F@[
I"read_timeout;TI"R;T;F@[
U:RDoc::Constant[i I"
Revision;FI"Net::SMTP::Revision;F00o;;[ ;@;0@@cRDoc::NormalClass0U;[i I"DEFAULT_AUTH_TYPE;FI"!Net::SMTP::DEFAULT_AUTH_TYPE;F00o;;[o;
;[I"Authentication;T;@;0@@@0U;[i I"
IMASK;FI"Net::SMTP::IMASK;F00o;;[ ;@;0@@@0U;[i I"
OMASK;FI"Net::SMTP::OMASK;F00o;;[ ;@;0@@@0U;[i I"CRAM_BUFSIZE;FI"Net::SMTP::CRAM_BUFSIZE;F00o;;[ ;@;0@@@0[ [[I"
class;T[[;[[I"default_port;F@[I"default_ssl_context;F@[I"default_ssl_port;F@[I"default_submission_port;F@[I"default_tls_port;F@[I"new;T@[I"
start;F@[:protected[ [:private[ [I"
instance;T[[;[/[I"auth_cram_md5;F@[I"auth_login;F@[I"auth_plain;F@[I"authenticate;F@[I"capable_auth_types;F@[I"capable_cram_md5_auth?;F@[I"capable_login_auth?;F@[I"capable_plain_auth?;F@[I"capable_starttls?;F@[I" data;F@[I"debug_output=;F@[I"disable_ssl;F@[I"disable_starttls;F@[I"disable_tls;F@[I" ehlo;F@[I"enable_ssl;F@[I"enable_starttls;F@[I"enable_starttls_auto;F@[I"enable_tls;F@[I"finish;F@[I" helo;F@[I"inspect;F@[I"
mailfrom;F@[I"open_message_stream;F@[I" quit;F@[I"rcptto;F@[I"rcptto_list;F@[I"read_timeout=;F@[I"
ready;F@[I" rset;F@[I"send_mail;F@[I"send_message;F@[I"
sendmail;F@[I"set_debug_output;F@[I" ssl?;F@[I"
start;F@[I"
started?;F@[I"
starttls;F@[I"starttls?;F@[I"starttls_always?;F@[I"starttls_auto?;F@[I" tls?;F@[;[ [;[[I"auth_capable?;F@[I"auth_method;F@[I"base64_encode;F@[I"
capable?;F@[I"check_auth_args;F@[I"check_auth_continue;F@[I"check_auth_method;F@[I"check_auth_response;F@[I"check_continue;F@[I"check_response;F@[I"cram_md5_response;F@[I"cram_secret;F@[I"
critical;F@[I"do_finish;F@[I"do_helo;F@[I"
do_start;F@[I"get_response;F@[I"
getok;F@[I"logging;F@[I"new_internet_message_io;F@[I"recv_response;F@[I"ssl_socket;F@[I"tcp_socket;F@[I"tlsconnect;F@[ [U:RDoc::Context::Section[i 0o;;[ ;0;0[@I"Net;FcRDoc::NormalModule