---
title: Ruby
description: Send emails via Reloop SMTP using net/smtp in Ruby.
---
> For the complete documentation index, see [llms-docs.txt](/llms-docs.txt) or the site index [llms.txt](/llms.txt). Full docs corpus: [llms-full-docs.txt](/llms-full-docs.txt). Prefer markdown URLs (append `.md`) for agent consumption. Product skill: [skill.md](/skill.md).


# Ruby SMTP Integration

You can send emails through Reloop using Ruby's standard `net/smtp` library.

[View complete runnable example on GitHub ↗](https://github.com/reloop-labs/reloop-examples/tree/main/smtp-ruby)

## Code Example

```ruby
require 'net/smtp'
require 'openssl'

api_key = ENV['RELOOP_API_KEY']

message = <<MESSAGE_END
From: onboarding@reloop.sh
To: delivered@resend.dev
MIME-Version: 1.0
Content-type: text/html
Subject: Hello from Ruby net/smtp

<p>Congrats on sending your first email via Reloop SMTP using net/smtp!</p>
MESSAGE_END

begin
  Net::SMTP.start('smtp.reloop.sh', 587, 'localhost', api_key, api_key, :plain) do |smtp|
    smtp.send_message message, 'onboarding@reloop.sh', 'delivered@resend.dev'
  end
  puts "Email sent successfully!"
rescue => e
  puts "Error: #{e.message}"
end
```

<RelatedTopics>
  <RelatedTopic icon="smtp" title="SMTP Integration Overview" href="/docs/examples/smtp/introduction" />
  <RelatedTopic icon="siRubyonrails" title="Ruby on Rails Guide" href="/docs/examples/ruby/rails" />
  <RelatedTopic icon="siPython" title="Python SMTP Guide" href="/docs/examples/smtp/python" />
</RelatedTopics>
