Net/smtp question

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, ‘[email protected]’,

[‘[email protected]’]
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:insend
from c:/ruby/lib/ruby/1.8/net/smtp.rb:571:in authenticate' from c:/ruby/lib/ruby/1.8/net/smtp.rb:411:indo_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:instart’
from C:/des/desktop/methods/experiments/smtp.rb:5
Process ruby exited with code 1

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

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 :slight_smile:

tsume@laptop:~$ telnet tsumelabs.com 25
Trying 72.21.54.43…
Connected to tsumelabs.com.
Escape character is ‘^]’.
220 zanshin.tsumelabs.com ESMTP
HELO FAKEDOMAIN.COM
250 zanshin.tsumelabs.com Ok.
EHLO FAKEDOMAIN.COM
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:[email protected]
250 Ok.
RCPT TO:[email protected]
250 Ok.
DATA
354 Ok.
Subject: Test Message
From: [email protected]

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: [email protected]
Return-Path: [email protected]
Received: from FAKEDOMAIN.COM ([209.112.145.186])
by zanshin.tsumelabs.com with esmtp; Tue, 22 Nov 2005 16:37:17 -0500
id 0068813E.43838FA9.000017BC
Subject: Test Message
To: [email protected]
From: [email protected]
Message-ID: [email protected]
Date: Tue, 22 Nov 2005 16:37:17 -0500

test

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

Notice the received from line

Received: from 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.

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: [email protected]
Return-Path: [email protected]
Received: from FAKEDOMAIN.COM ([209.112.145.186])
by 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 ([205.2.145.186])
by some-otherhost.com with esmtp; Tue, 22 Nov 2005 16:34:17 -0500
id 0068813E.43838FA9.000017BC
Subject: Test Message
To: [email protected]
From: [email protected]
Message-ID: [email protected]
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/

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

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 with esmtp (Exim 4.50)
id 1Eezll-00068m-O3
for [email protected]; 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

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 :slight_smile:

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

Net::SMTP.start(‘smtp.server’,25) do |smtp|
smtp.send_message msg, '[email protected],
['[email protected]]
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

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, '[email protected],
['[email protected]]
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” [email protected] wrote in message
news:[email protected]