Question

Is it possible to send an email from Smalltalk using a Gmail account? I have configured my company mail server with Smalltalk to send email, but that's not going to cut it when I distribute the application. Answers with any of using Outlook, Yahoo or Gmail are acceptable.

Was it helpful?

Solution

You should state which Smalltalk you are using since there are different dialects and all have different ways of handling things like e-mail.

In Pharo, check out the class SMTPClient. There are class methods that have example methods showing how to send e-mails.

For VisualWorks, load the parcel NetClients and check out the classes MailMessage and SMTPClient.

Here's an example of code that sends an e-mail in VisualWorks:

(Net.SMTPClient host: Net.NetClient netSettings defaultOutgoingHost name)
        user: Net.NetClient netSettings defaultOutgoingHost netUser;
        send: (Net.MailMessage newTextPlain
            subject: 'This is the subject';
            from: 'my-email@gmail.com';
            to: 'your-email@gmail.com';
            text: 'This is the body';
            yourself).

OTHER TIPS

For secure mail sending, take a look at ZdcSecureSMTPClient in Zodiac-Extra on a Pharo 2.0 image. Class side shows using gmail.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top