Method: Net::SMTP#send_message
- Defined in:
- lib/net/smtp.rb
#send_message(msgstr, from_addr, *to_addrs) ⇒ Object Also known as: send_mail, sendmail
Sends msgstr as a message. Single CR (“r”) and LF (“n”) found in the msgstr, are converted into the CR LF pair. You cannot send a binary message with this method. msgstr should include both the message headers and body.
from_addr is a String representing the source mail address.
to_addr is a String or Strings or Array of Strings, representing the destination mail address or addresses.
Example
Net::SMTP.start('smtp.example.com') do |smtp|
smtp. msgstr,
'[email protected]',
['[email protected]', '[email protected]']
end
Errors
This method may raise:
-
Net::SMTPServerBusy
-
Net::SMTPSyntaxError
-
Net::SMTPFatalError
-
Net::SMTPUnknownError
-
IOError
-
TimeoutError
573 574 575 576 577 |
# File 'lib/net/smtp.rb', line 573 def (msgstr, from_addr, *to_addrs) send0(from_addr, to_addrs.flatten) { @socket. msgstr } end |