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