Created
March 29, 2012 12:19
-
-
Save pjb3/2236751 to your computer and use it in GitHub Desktop.
Running this with mailcatcher results in a "503 MAIL already given"
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
#!/usr/bin/env ruby | |
require 'net/smtp' | |
require 'time' | |
def send_message(smtp, from, to) | |
msg = %{From: #{from} | |
To: #{to} | |
Subject: test message | |
Date: #{Time.now.rfc2822} | |
Message-Id: <#{Time.now.to_f}@example.com> | |
This is a test message. | |
} | |
smtp.send_message(msg, from, to) | |
end | |
Net::SMTP.start('localhost', 1025) do |smtp| | |
send_message(smtp, 'from@example.com', 'to1@example.com') | |
send_message(smtp, 'from@example.com', 'to2@example.com') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment