Files
Sun1602/Server/Scripts/simple_smtp.rb
T
2022-10-26 12:25:11 +08:00

19 lines
392 B
Ruby

require 'net/smtp'
class SimpleSmtp
attr_accessor :smtp_host, :from, :from_alias, :to, :to_alias, :subject, :message
def initialize()
end
def send()
msg = <<END_OF_MESSAGE
From: #{@from_alias} <#{@from}>
To: #{@to_alias} <#{@to}>
Subject: #{@subject}
#{@message}
END_OF_MESSAGE
Net::SMTP.start(@smtp_host) do |smtp|
smtp.send_message(msg, @from, @to)
end
end
end