Email application in Ruby


#1

I want to make an email application in ruby, and I made one, but it didn't work. Do you guys know what I am doing wrong? Here is the source code:

require 'net/smtp'

message = <<MESSAGE_END
From: Private Person e_posner@outlook.com
To: Enpro megaherobrinecraft@gmail.com
Subject: SMTP e-mail test

Hello
MESSAGE_END

Net::SMTP.start('e_posner@outlook.com', 25, 'localhost', 'e_posner@outlook.com', 'Censored') do |smtp|
smtp.send_message message, 'e_posner@outlook.com',
'megaherobrinecraft@gmail.com'
end


#2

Please, explain SMTP. Thanks.


#3

smtp stands for simple mail transfer protocol. It is the standard of how emailing works. Here is a page on Wikipedia that explains it further: https://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol


#4

You need to connect to the SMTP server, 'e_posner@outlook.com' is not the server address, right? :slight_smile:

Documentation -> http://ruby-doc.org/stdlib-2.0.0/libdoc/net/smtp/rdoc/Net/SMTP.html

Address of outlook SMTP server is smtp-mail.outlook.com:387.