# Net/smtp authorization exception

**URL:** <https://www.ruby-forum.com/t/net-smtp-authorization-exception/181747>\
**Category:** Ruby\
**Created:** [January 17, 2010, 7:58pm UTC](https://www.ruby-forum.com/t/net-smtp-authorization-exception/181747 "2010-01-17T19:58:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ronaldfischer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/67e7ee/32.png) [@ronaldfischer](https://www.ruby-forum.com/u/ronaldfischer)\
**Post date:** [January 17, 2010, 7:58pm UTC](https://www.ruby-forum.com/t/net-smtp-authorization-exception/181747/1 "2010-01-17T19:58:38Z")

</div>

I can’t send email using net/smtp from my mac running OSX 10.4. The SMTP  
server  
is run by my Internet Service Provider. Any idea  
what I’m doing wrong? This is my code:

Net::SMTP.start(‘[mail.mnet-online.de](http://mail.mnet-online.de)’,25,‘localhost.localdomain’,  
‘removed\_email\_address@domain.invalid’,‘my password goes here’, :login)

I get the exception

/usr/local/lib/ruby/1.8/net/smtp.rb:680:in `check\_response’: 538 5.7.0  
Encryption required for requested authentication mechanism  
(Net::SMTPUnknownError)

Sending mail works fine using the Mac mail.app with the settings which  
you can  
see in the attached screenshot. It also works from the shell using  
mailx.

Althought :login seems to be the natural choice for the encryption  
mechanism, I also tried :plain and the default, but (as expected) with  
the same effect.

I suspect that the 3rd parameter (the HELO domain) is incorrect (I used  
the  
default described at  
[http://ruby-doc.org/stdlib/libdoc/net/smtp/rdoc/classes/Net/SMTP.html#M000810](http://ruby-doc.org/stdlib/libdoc/net/smtp/rdoc/classes/Net/SMTP.html#M000810)),  
but I don’t know what sensible value I should put here. BTW, I tried  
also the  
name which is output by uname -n as HELO domain, but with the same  
result.

If you look at the attached screenshot, you can see that mail.app  
connects to  
the SMTP server using SSL encryption, so maybe this would be necessary  
here  
too, but I have no idea how to mimic this within Ruby.

Ronald

---

<div class="post-metadata">

**Author:** ![ronaldfischer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/67e7ee/32.png) [@ronaldfischer](https://www.ruby-forum.com/u/ronaldfischer)\
**Post date:** [January 17, 2010, 10:34pm UTC](https://www.ruby-forum.com/t/net-smtp-authorization-exception/181747/2 "2010-01-17T22:34:00Z")

</div>

I think this may help you:

> **[How to use GMail SMTP server to send emails in Rails ActionMailer](http://www.stephenchu.com/2006/06/how-to-use-gmail-smtp-server-to-send.html)**
>
> Recently I had to use Ruby to send emails. I don't want to go through the hassle of setting up a mail server on my build box, and since I us...

-Jonathan N.
