-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSend.rb
More file actions
37 lines (27 loc) · 719 Bytes
/
Send.rb
File metadata and controls
37 lines (27 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require 'net/smtp'
require 'mail'
require 'base64'
require_relative 'Utilities.rb'
include Utilities
class Send
def initialize
server = 'smtp.gmail.com'
mail_from_domain = 'gmail.com'
port = 587 # or 25 - double check with your provider
username = 'btheer108@gmail.com'
password = 'bobtheer108'
@smtp = Net::SMTP.new(server, port)
@smtp.enable_starttls_auto
@smtp.start(server,username,password, :plain)
end
def send_mail(text, subject, sender, rcpt)
email = 'btheer108@gmail.com'
message = <<END_OF_EMAIL
From: Your Name <#{sender}>
To: Other Email <#{rcpt}>
Subject: #{subject}
#{text}
END_OF_EMAIL
@smtp.send_message(message, sender, rcpt)
end
end