Created
November 12, 2014 01:52
-
-
Save mfkp/15b8716c37702c088201 to your computer and use it in GitHub Desktop.
mail spammer for testing lots of emails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/smtp' | |
# instructions: | |
# set 2 environment variables: EMAIL & PW (assuming gmail in smtp settings) | |
# change from_domain to your email provider domain | |
# change from_name to your name | |
# change 'to' to the recipients of your spam | |
# run 'ruby spam.rb' | |
def sendMail(body) | |
from = ENV['EMAIL'] | |
from_domain = 'gmail.com' | |
from_name = 'Kyle Powers' | |
to = %w([email protected] [email protected]) | |
subject = "KYLE IS JUST.BEST #{rand(1..50)}" | |
message = <<MESSAGE | |
From: #{from_name} <#{from}> | |
To: #{to.join(', ')} | |
MIME-Version: 1.0 | |
Content-type: text/html | |
Subject: #{subject} | |
MESSAGE | |
smtp = Net::SMTP.new('smtp.gmail.com', 587) | |
smtp.enable_starttls | |
smtp.start(from_domain, from, ENV['PW'], :login) do | |
smtp.send_message([message, body].join("\r\n"), from, to) | |
end | |
end | |
loop do | |
sendMail(Time.now.to_i.to_s(36)) | |
puts 'Email sent at ' + Time.now.to_s | |
pauseTime = rand(1..3)*60 # sleep between 1 and 3 minutes | |
puts 'Sleeping for ' + (pauseTime/60).to_s + ' minutes' | |
sleep pauseTime | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment