Wednesday, November 14, 2007

Squeak and SMTPClient

Apparently, no one uses SMTPClient because there is a bug that has lingered for ages. Using it raises the following Squeak error message:

TelnetProtocolError: 501 malformed auth input (#5.5.4)

Here's my test Squeak method:

mailTo: userAddress subject: subject text: text
....| client |
....client := SMTPClient openOnHostNamed: 'host_mail_server' port: 25.
....client user: 'my_user_id'; password: 'my_password'; login; initiateSession.
....client mailFrom: 'my_email_address';
........recipient: userAddress;
........data: text.
....client quit.


I managed to find a fix. In the #encodeString: method of the #SMTPClient in the Network-Protocols package, amend the last statement to read:

....^ str truncateTo: (str size - 2)

Perhaps it will be fixed in the next Squeak release. It's probably very low priority as I seem to be the only person who cares about it.

No comments: