links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Last updated at 4:46 am UTC on 25 January 2009
Squeak, and Celeste in particular, uses class MailMessage to store and access an Internet email message. Here are some of the handier methods it has:
  1. from: (class method) – parse a message from a string, and return a MailMessage object
  2. fieldNamed:ifAbsent: – look up a header field, e.g. the From line.
  3. fieldsNamed:ifAbsent: – look up all instances of a header field
  4. bodyText – return the body of the message as a Text
  5. body – return the body of the message as a MIMEDocument
  6. parts – return the parts

Note that header fields are returned as MIMEHeaderValue's, not as raw strings. This class is easy to use – just check out the code.

MailMessages may also be constrnucted in code, with methods like:
  1. empty (class method) – create an MailMessage with no headers and an empty body
  2. setField:toString: – modify a header field
  3. body: – set the body
  4. addAttachmentFrom:withName: – add an binary attachment

Here's a simple example:
(MailMessage empty
    setField: 'date' toString: MailMessage dateStampNow;
    setField: 'from' toString: aFromString;
    setField: 'to' toString: aToString;
    setField: 'subject' toString: aSubjectString;
    body: (MIMEDocument content: 'testing'))

Right now, the construction methods are limitted – there is just enough present to support Celeste composition windows.