[squeak-dev] SMTPClient with bad command sequence

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] SMTPClient with bad command sequence

Torsten Bergmann
Hi,

I want to send a mail using an authenticated SMTP server.
But Squeak does not deliver the mail after evaluating the
following code:

|ip client message|
ip := NetNameResolver addressForName: 'smtp.yourprovider.com'.
client := SMTPClient new.
client user: 'itsme'.
client password: 'mypassword'.
client openOnHost: ip port: 25.
message := 'From: "[hidden email]"
To: [hidden email]
Subject: Test

Just a test'.
[client mailFrom: '[hidden email]' to: {'[hidden email]'}  text: message.
         client quit] ensure: [client close]


The SMTP server sends back an "503 Bad sequence of commands" error.
After digging into the protocol I found out the correct order
(HELO was missing) and patched the system by adding the following
method to SMTPClient


ensureConnection
        self isConnected
                ifTrue: [^self].
        self stream
                ifNotNil: [self stream close].

        self stream: (SocketStream openConnectionToHost: self host port: self port).
        self checkResponse.
        self initiateSession.
        self login


Only the line with "self initiateSession" is new compared to the superclass method in ProtocolClient. But it is awfull to copy down
most parts of the superclass method.

Who is taking care of the Network-Protocols package so we can
apply a better (refactored) solution?

Thx
Torsten





 
--
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] SMTPClient with bad command sequence

Göran Krampe
Hi!

"Torsten Bergmann" <[hidden email]> wrote:
> Hi,
>
> I want to send a mail using an authenticated SMTP server.

Just wish to note that fixes have been posted to Mantis - even
duplicated unfortunately. Just search for "SMTP" there and you will
find:

http://bugs.squeak.org/view.php?id=6768
http://bugs.squeak.org/view.php?id=6843 
(seems I might have duplicated this one:
http://bugs.squeak.org/view.php?id=6767)

regards, Göran