
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
= mini-smtp-server
MiniSmtpServer is a small and easily customizable SMTP server. It is designed mainly to be integrated into other systems that will decide what to do with the mail that is received. By default mini-smtp-server operates as a black-hole and does not do anything with the mail being sent to it... Don't let that discourage you though, as MiniSmtpServer is designed to be extremely easy to customize which makes it fit more easily into your system!
=== Using the server
To run the default server simply use:
server = MiniSmtpServer.new(2525, "127.0.0.1", 4)
server.start
server.shutdown while(server.connections > 0) sleep 0.01 end server.stop server.join
=== Installation
For convenience MiniSmtpServer is packaged as a RubyGem, to install it simply enter the following at your command line:
gem install mini-smtp-server
=== Customizing the server
MiniSmtpServer is designed to be easy to customize via subclassing. Simply subclass the MiniSmtpServer
class and re-define the new_message_event
event handler:
class StdoutSmtpServer < MiniSmtpServer
def new_message_event(message_hash)
puts "# New email received:"
puts "-- From: #{message_hash[:from]}"
puts "-- To: #{message_hash[:to]}"
puts "--"
puts "-- " + message_hash[:data].gsub(/\r\n/, "\r\n-- ")
puts
end
end
Then create an instance of your new server and run it like you would normally:
server = StdoutSmtpServer.new server.start server.join
The possibilities are endless, and easy to implement! Want all your email stored in a database? No worries:
class DatabaseSmtpServer < MiniSmtpServer def new_message_event(message_hash) # Imagine we have an ActiveRecord model named 'Email' Email.create(message_hash) end end
If you have a great example of something you've done with MiniSmtpServer let me know and I will add it here!
=== Author & Credits
Author:: {Aaron Gough}[mailto:aaron@aarongough.com]
MiniSmtpServer is based on code originally written by {Peter Cooper}[http://peterc.org/]
Copyright (c) 2010 {Aaron Gough}[http://thingsaaronmade.com/] ({thingsaaronmade.com}[http://thingsaaronmade.com/]), released under the MIT license
FAQs
Unknown package
We found that mini-smtp-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.