# 1.8.7 SMTP TLS How to?

**URL:** <https://www.ruby-forum.com/t/1-8-7-smtp-tls-how-to/190379>\
**Category:** Ruby\
**Created:** [June 18, 2010, 9:38pm UTC](https://www.ruby-forum.com/t/1-8-7-smtp-tls-how-to/190379 "2010-06-18T21:38:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tcsnide](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@tcsnide](https://www.ruby-forum.com/u/tcsnide)\
**Post date:** [June 18, 2010, 9:38pm UTC](https://www.ruby-forum.com/t/1-8-7-smtp-tls-how-to/190379/1 "2010-06-18T21:38:52Z")

</div>

I know that Ruby 1.8.7 is supposed to support SMTP TLS but damn if I  
can find a lick of documentation on it. I had been using the smtp\_tls  
gem, but wanted to update my code.

Can anyone fill me it?

Thanks.

---

<div class="post-metadata">

**Author:** ![tcsnide](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@tcsnide](https://www.ruby-forum.com/u/tcsnide)\
**Post date:** [June 19, 2010, 12:06am UTC](https://www.ruby-forum.com/t/1-8-7-smtp-tls-how-to/190379/2 "2010-06-19T00:06:24Z")

</div>

Well, after beating my head again wall for a couple of hours I answer  
my own question:

```
  smtp = Net::SMTP.new(server, port)
  smtp.enable_starttls
  smtp.start(domain, account, secret, login) do |s|
    s.send_message(msg, from, mailto)
  end

```

Why I was having a problem. This does not work:

```
  Net::SMTP.start(server, port, domain, account, secret, login) do

```

|s|  
s.enable\_starttls  
s.send\_message(msg, from, mailto)  
end

~trans

---

<div class="post-metadata">

**Author:** ![tcsnide](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@tcsnide](https://www.ruby-forum.com/u/tcsnide)\
**Post date:** [June 21, 2010, 7:48pm UTC](https://www.ruby-forum.com/t/1-8-7-smtp-tls-how-to/190379/3 "2010-06-21T19:48:58Z")

</div>

> Why I was having a problem. This does not work:
> 
> ```
> Net::SMTP.start(server, port, domain, account, secret, login) do
> 
> ```
> 
> |s|  
> s.enable\_starttls  
> s.send\_message(msg, from, mailto)  
> end

bug? impossibility?  
-r
