Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
How to send an email message from Squeak while I don't have access to any external SMTP server
Last updated at 12:54 pm UTC on 17 January 2006
The problem here is not so much how to send a mail message from Squeak, but how to find the SMTP server which will handle that mail.
Sending from within Squeak is simple once you know the mail server to talk to:
| message sender recipients |
message := 'From: Me <my.address@example.invalid>
To: You <your.address@another.invalid>
Subject: Simple Mail from Squeak

This is a test mail'.
sender := 'my.address@example.invalid'.
recipients := #('your.address@another.invalid').
SMTPClient
	deliverMailFrom: sender
	to: recipients
	text: message
	usingServer: 'name.of.mail.server'

However, finding the name of the mail server is difficult. You need to look up an MX (Mail eXchange) record for the recipient domain with th DNS system, and Squeak does not provide an interface to that (which really is a pity).
That's the main reason why Squeak is wimping out and only delivers to a server address that you provide.
The other reason is that in theses days of spam and worms and viruses, many incoming mail servers don't accept mail from dynamic IP addresses anymore, so even if you find the MX for a given mail address, chances are good that it won't accept mail from you.

Cheers,
Hans-Martin