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 <email@example.com>
To: You <firstname.lastname@example.org>
Subject: Simple Mail from Squeak
This is a test mail'.
sender := 'email@example.com'.
recipients := #('firstname.lastname@example.org').
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.