File: //usr/local/rvm/gems/ruby-2.6.8/doc/mail-2.7.1/ri/Mail/SMTP/cdesc-SMTP.ri
U:RDoc::NormalClass[iI" SMTP:ETI"Mail::SMTP;TI"Object;To:RDoc::Markup::Document:@parts[o;;[#S:RDoc::Markup::Heading:
leveli: textI"Sending Email with SMTP;To:RDoc::Markup::BlankLine o:RDoc::Markup::Paragraph;[I"WMail allows you to send emails using SMTP. This is done by wrapping Net::SMTP in ;TI"an easy to use manner.;T@S; ;
i;I")Sending via SMTP server on Localhost;T@o;
;[I"USending locally (to a postfix or sendmail server running on localhost) requires ;TI"Tno special setup. Just to Mail.deliver &block or message.deliver! and it will ;TI"be sent in this method.;T@S; ;
i;I"Sending via MobileMe;T@o:RDoc::Markup::Verbatim;[I"Mail.defaults do
;TI"H delivery_method :smtp, { :address => "smtp.me.com",
;TI"> :port => 587,
;TI"K :domain => 'your.host.name',
;TI"G :user_name => '<username>',
;TI"G :password => '<password>',
;TI"B :authentication => 'plain',
;TI"A :enable_starttls_auto => true }
;TI" end
;T:@format0S; ;
i;I"Sending via GMail;T@o;;[I"Mail.defaults do
;TI"K delivery_method :smtp, { :address => "smtp.gmail.com",
;TI"> :port => 587,
;TI"K :domain => 'your.host.name',
;TI"G :user_name => '<username>',
;TI"G :password => '<password>',
;TI"B :authentication => 'plain',
;TI"A :enable_starttls_auto => true }
;TI" end
;T;0S; ;
i;I"Certificate verification;T@o;
;[
I"QWhen using TLS, some mail servers provide certificates that are self-signed ;TI"Lor whose names do not exactly match the hostname given in the address. ;TI"QOpenSSL will reject these by default. The best remedy is to use the correct ;TI"Mhostname or update the certificate authorities trusted by your ruby. If ;TI"=that isn't possible, you can control this behavior with ;TI"Ian :openssl_verify_mode setting. Its value may be either an OpenSSL ;TI"Rverify mode constant (OpenSSL::SSL::VERIFY_NONE, OpenSSL::SSL::VERIFY_PEER), ;TI"Lor a string containing the name of an OpenSSL verify mode (none, peer).;T@S; ;
i;I"Others ;T@o;
;[I"9Feel free to send me other examples that were tricky;T@S; ;
i;I"Delivering the email;T@o;
;[I"DOnce you have the settings right, sending the email is done by:;T@o;;[I"Mail.deliver do
;TI"$ to 'mikel@test.lindsaar.net'
;TI"$ from 'ada@test.lindsaar.net'
;TI"" subject 'testing sendmail'
;TI" body 'testing sendmail'
;TI" end
;T;0o;
;[I",Or by calling deliver on a Mail message;T@o;;[
I"mail = Mail.new do
;TI"$ to 'mikel@test.lindsaar.net'
;TI"$ from 'ada@test.lindsaar.net'
;TI"" subject 'testing sendmail'
;TI" body 'testing sendmail'
;TI" end
;TI"
;TI"mail.deliver!;T;0:
@fileI".lib/mail/network/delivery_methods/smtp.rb;T:0@omit_headings_from_table_of_contents_below0;0;0[[
I"
settings;TI"RW;T:publicFI".lib/mail/network/delivery_methods/smtp.rb;T[U:RDoc::Constant[i I"
DEFAULTS;TI"Mail::SMTP::DEFAULTS;T;0o;;[ ;@a;0@a@cRDoc::NormalClass0[ [[I"
class;T[[;[[I"new;T@f[:protected[ [:private[ [I"
instance;T[[;[[I"
deliver!;T@f[;[ [;[[I"build_smtp_session;T@f[I"ssl_context;T@f[I"start_smtp_session;T@f[ [U:RDoc::Context::Section[i 0o;;[ ;0;0[@aI" Mail;TcRDoc::NormalModule