tulipemoutarde.be

Software Developer

Smalltalk, Swift, Java, Obj-C

@fstephany | Email | LinkedIn

I'm currently working at Ta Mère SCRL a small development shop in Belgium.

We mainly do mobile apps (iOS, Android) for clients. We also have a strong interest in Pharo Smalltalk and Rust.

logo Ta Mère SCRL

Send email from Pharo with Postmark

29 Dec 2011 in library pharo postmark smalltalk 

I recently needed to send emails from a Pharo image. There is a SMTP client integrated in the standard libray but I wanted to wrap the excellent Postmark REST API.

You can load it from SqueakSource 3:

Gofer it
     url: 'http://ss3.gemstone.com/ss/postmark';
     package: 'ConfigurationOfPostMark';
     load.

(Smalltalk at: #ConfigurationOfPostMark) project stableVersion load.

And you can use it like:

| email interface |
email := PMEmail new
  from: 'francois@wapict.be';
  to: 'francois@yopmail.com';
  subject: 'Test Application';
  textBody: 'Yeah baby';
  yourself.

interface := PMInterface new.
interface apiKey: 'blopblop'.

interface send: email.

The implementation is really basic and does not handle attachments at the moment. I use it on a staging application that will probably be in production in January. I will see how it behaves under small load and improve it if needed.

edit: you can now attach files to your emails !