# Net/smtp question

**URL:** <https://www.ruby-forum.com/t/net-smtp-question/52953>\
**Category:** Ruby\
**Created:** [November 23, 2005, 2:06am UTC](https://www.ruby-forum.com/t/net-smtp-question/52953 "2005-11-23T02:06:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![itsme213](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/258eb7/32.png) [@itsme213](https://www.ruby-forum.com/u/itsme213)\
**Post date:** [November 23, 2005, 2:06am UTC](https://www.ruby-forum.com/t/net-smtp-question/52953/1 "2005-11-23T02:06:07Z")

</div>

I am experimenting with SMTP mail from my local machine, to basically  
send  
an email just like my Outlook client does. But I can’t figure out how to  
translate my Outlook settings to the parameters of SMTP.start, in  
particular  
the params:

helo : I don’t see such a setting in Outlook. I use a cable service  
provider for internet connection, the SMTP server is different (at my  
web  
host).

user : is this the User Name from the Outlook account?

secret : is this the Password from the Outlok account?

authtype : my Outlook account has “requires authentication” OFF

Thanks!

require ‘net/smtp’

msg = “Subject: Test\n\nNow is the time\n”

Net::SMTP.start('my.smtp.server,25,‘my.cable.provider’,'my.user.name,  
'password,:plain) do |smtp|

# smtp.send\_message msg, ‘removed\_email\_address@domain.invalid’,

[‘removed\_email\_address@domain.invalid’]  
end

C:experiments\> c:/ruby/lib/ruby/1.8/net/smtp.rb:586:in `auth_login': 535 authorization failed (#5.7.0) (Net::SMTPAuthenticationError) from c:/ruby/lib/ruby/1.8/net/smtp.rb:571:in` **send** ’  
from c:/ruby/lib/ruby/1.8/net/smtp.rb:571:in `authenticate' from c:/ruby/lib/ruby/1.8/net/smtp.rb:411:in`do\_start’  
from c:/ruby/lib/ruby/1.8/net/smtp.rb:378:in `start' from c:/ruby/lib/ruby/1.8/net/smtp.rb:316:in`start’  
from C:/des/desktop/methods/experiments/smtp.rb:5  
Process ruby exited with code 1

---

<div class="post-metadata">

**Author:** ![itsme213](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/258eb7/32.png) [@itsme213](https://www.ruby-forum.com/u/itsme213)\
**Post date:** [November 23, 2005, 4:51am UTC](https://www.ruby-forum.com/t/net-smtp-question/52953/2 "2005-11-23T04:51:04Z")

</div>

On Wednesday 23 November 2005 10:02 am, itsme213 wrote:

> I am experimenting with SMTP mail from my local machine, to basically send  
> an email just like my Outlook client does. But I can’t figure out how to  
> translate my Outlook settings to the parameters of SMTP.start, in  
> particular the params:
> 
> helo : I don’t see such a setting in Outlook. I use a cable service  
> provider for internet connection, the SMTP server is different (at my web  
> host).

You are a client, you still need to use the correct HELO.

HELO [myhostname-12-34-34-2.myisp.com](http://myhostname-12-34-34-2.myisp.com)

would be what you want to say to server, just supply hostname.

Here is an example SMTP session to my mail server using one of the  
number one  
administration utilities… telnet 🙂

tsume@laptop:~$ telnet [tsumelabs.com](http://tsumelabs.com) 25  
Trying 72.21.54.43…  
Connected to [tsumelabs.com](http://tsumelabs.com).  
Escape character is ‘^]’.  
220 [zanshin.tsumelabs.com](http://zanshin.tsumelabs.com) ESMTP  
HELO [FAKEDOMAIN.COM](http://FAKEDOMAIN.COM)  
250 [zanshin.tsumelabs.com](http://zanshin.tsumelabs.com) Ok.  
EHLO [FAKEDOMAIN.COM](http://FAKEDOMAIN.COM)  
[250-zanshin.tsumelabs.com](http://250-zanshin.tsumelabs.com) Ok.  
250-AUTH LOGIN CRAM-MD5 CRAM-SHA1 CRAM-SHA256  
250-AUTH=LOGIN CRAM-MD5 CRAM-SHA1 CRAM-SHA256 X-NETSCAPE-HAS-BUGS  
250-XVERP=Courier  
250-XEXDATA  
250-XSECURITY=NONE,STARTTLS  
250-PIPELINING  
250-8BITMIME  
250-SIZE  
250 DSN  
MAIL FROM:[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
250 Ok.  
RCPT TO:[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
250 Ok.  
DATA  
354 Ok.  
Subject: Test Message  
From: removed\_email\_address@domain.invalid

test

.  
250 Ok. 43838FA9.000017BC  
quit  
221 Bye.

## When the email is delivered, the email is altered by the MTA. Below is what the client(I) get when I check my mail via POP3. [start]

Delivered-To: removed\_email\_address@domain.invalid  
Return-Path: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Received: from [FAKEDOMAIN.COM](http://FAKEDOMAIN.COM) ([209.112.145.186])  
by [zanshin.tsumelabs.com](http://zanshin.tsumelabs.com) with esmtp; Tue, 22 Nov 2005 16:37:17 -0500  
id 0068813E.43838FA9.000017BC  
Subject: Test Message  
To: removed\_email\_address@domain.invalid  
From: removed\_email\_address@domain.invalid  
Message-ID: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Tue, 22 Nov 2005 16:37:17 -0500

test

[end] ---------------------------------------

Notice the received from line

Received: from [FAKEDOMAIN.COM](http://FAKEDOMAIN.COM) ([209.112.145.186])  
Still the MTA will place my IP address in the header, I’m really on

tsume@laptop:~$ nslookup 209.112.145.186  
Server: 209.193.4.7  
Address: 209.193.4.7#53

186.145.112.209.in-addr.arpa name =  
[209-112-145-186-cdsl-rb1.sol.acsalaska.net](http://209-112-145-186-cdsl-rb1.sol.acsalaska.net).

tsume@laptop:~$

Many spammers fake the HELO, and I know some MTAs actually do check for  
a  
valid HELO, so you want to use the correct hostname.

Do I still need to provide a helo if I send the email to my ISPs server?  
yes, the mail server still attaches receive. Look through emails and you  
will  
see more of how the MTA will transform emails, here is an example

## [start]

Delivered-To: removed\_email\_address@domain.invalid  
Return-Path: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Received: from [FAKEDOMAIN.COM](http://FAKEDOMAIN.COM) ([209.112.145.186])  
by [zanshin.tsumelabs.com](http://zanshin.tsumelabs.com) with esmtp; Tue, 22 Nov 2005 16:37:17 -0500  
id 0068813E.43838FA9.000017BC  
Received: from [littleguy-23.2.32.3.isp.com](http://littleguy-23.2.32.3.isp.com) ([205.2.145.186])  
by [some-otherhost.com](http://some-otherhost.com) with esmtp; Tue, 22 Nov 2005 16:34:17 -0500  
id 0068813E.43838FA9.000017BC  
Subject: Test Message  
To: removed\_email\_address@domain.invalid  
From: removed\_email\_address@domain.invalid  
Message-ID: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Tue, 22 Nov 2005 16:37:17 -0500

test

[end] ---------------------------------------

Ask more questions if confused.

There are RFCs on SMTP you should read for future reference

[http://www.rfc-editor.org/](http://www.rfc-editor.org/)

Have more fun learning!

Tsume

> user : is this the User Name from the Outlook account?

yes, this may be your email name, or your full email address

> secret : is this the Password from the Outlok account?

yes

---

<div class="post-metadata">

**Author:** ![itsme213](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/258eb7/32.png) [@itsme213](https://www.ruby-forum.com/u/itsme213)\
**Post date:** [November 23, 2005, 8:12pm UTC](https://www.ruby-forum.com/t/net-smtp-question/52953/3 "2005-11-23T20:12:24Z")

</div>

On Thu, 24 Nov 2005, itsme213 wrote:

> end
> 
> And it went through fine. I am a bit taken aback that there appears to be no  
> checking done at all. Is this normal?
> 
> Thanks!

Going by the headers in that message:

Received: from localhost ([127.0.0.1] helo=localhost.localdomain)  
by [sinus.lauschmusik.de](http://sinus.lauschmusik.de) with esmtp (Exim 4.50)  
id 1Eezll-00068m-O3  
for removed\_email\_address@domain.invalid; Wed, 23 Nov 2005 19:55:01 +0100

your smtp host is running exim, which will figure most of this out  
anyway. and it depends how much checking the admin has put into the  
config as to what is and what is not accepted.

```
    http://www.exim.org

```

for more than you wanted to know about this.

```
    Hugh

```

---

<div class="post-metadata">

**Author:** ![itsme213](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/258eb7/32.png) [@itsme213](https://www.ruby-forum.com/u/itsme213)\
**Post date:** [November 23, 2005, 11:34pm UTC](https://www.ruby-forum.com/t/net-smtp-question/52953/4 "2005-11-23T23:34:29Z")

</div>

On Thursday 24 November 2005 03:57 am, itsme213 wrote:

> I tried \<my\_host\>-12-34-34-2.myisp.com and it failed.
> 
> Then … Ouch! I just tried removing my email login, password, and even  
> HELO info:

Most ISPs will just have the SMTP server open to all clients on their  
network.  
Meaning you probably don’t need authentication applied to your script.  
The  
HELO is supposed to work however, what is the fail message? the HELO is  
supposed to be applied as the RFC states, but I really doubt it is  
failing.  
The HELO is defaulted to localhost.localdomain if you don’t supply an  
argument for the HELO in net/smtp.rb

The example I shown was me communicating with my server, which I  
definitely  
don’t route through for the internet 🙂

> msg = “Subject: Test\n\nNow is the time\n”
> 
> Net::SMTP.start(‘smtp.server’,25) do |smtp|  
> smtp.send\_message msg, 'removed\_email\_address@domain.invalid,  
> ['removed\_email\_address@domain.invalid]  
> end
> 
> And it went through fine. I am a bit taken aback that there appears to be  
> no checking done at all. Is this normal?

I’m guessing the SMTP server was choking at the authentication.

Tsume

---

<div class="post-metadata">

**Author:** ![itsme213](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/258eb7/32.png) [@itsme213](https://www.ruby-forum.com/u/itsme213)\
**Post date:** [November 23, 2005, 8:00pm UTC](https://www.ruby-forum.com/t/net-smtp-question/52953/5 "2005-11-23T20:00:17Z")

</div>

I tried \<my\_host\>-12-34-34-2.myisp.com and it failed.

Then … Ouch! I just tried removing my email login, password, and even  
HELO  
info:

msg = “Subject: Test\n\nNow is the time\n”

Net::SMTP.start(‘smtp.server’,25) do |smtp|  
smtp.send\_message msg, 'removed\_email\_address@domain.invalid,  
['removed\_email\_address@domain.invalid]  
end

And it went through fine. I am a bit taken aback that there appears to  
be no  
checking done at all. Is this normal?

Thanks!

“Tsume” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote in message  
news:removed\_email\_address@domain.invalid…
