Squeak Class Documentation category index | class index  
 
MailMessage
  category: Network-Mail Reader
  superclass: Object
  subclasses:

I represent an Internet mail or news message.

text - the raw text of my message
body - the body of my message, as a MIMEDocument
fields - a dictionary mapping lowercased field names into collections of MIMEHeaderValue's
parts - if I am a multipart message, then this is a cache of my parts

instance methods
  access
  body
bodyText
cc
date
fields
from
name
subject
text
time
to

  fields
  canonicalFields
fieldNamed:ifAbsent:
fieldsNamed:ifAbsent:
fieldsNamed:separatedBy:
hasFieldNamed:
removeFieldNamed:
rewriteFields:append:

  initialize-release
  body:
from:
initialize
setField:to:
setField:toString:

  multipart
  addAttachmentFrom:withName:
atomicParts
attachmentSeparator
decoderClass
makeMultipart
parseParts
parts
save

  parsing
  fieldsFrom:do:
headerFieldsNamed:do:
readDateFrom:
reportField:to:
skipWeekdayName:
timeFrom:

  printing/formatting
  asSendableText
bodyTextFormatted
cleanedHeader
excerpt
fieldsAsMimeHeader
format
formattedText
printOn:
regenerateBodyFromParts
regenerateText
viewBody
viewImageInBody

  testing
  containsViewableImage
selfTest

class methods
  instance creation
  empty
from:

  preferences
  omittedHeaderFields

  testing
  selfTest

  utilities
  dateStampNow
generateSeparator

instance methods
  access top  
 

body

return just the body of the message


 

bodyText

return the text of the body of the message


 

cc


 

date

Answer a date string for this message.


 

fields

return the internal fields structure. This is private and subject to change!


 

from


 

name

return a default name for this part, if any was specified. If not, return nil


 

subject


 

text

the full, unprocessed text of the message


 

time


 

to


  fields top  
 

canonicalFields

Break long header fields and escape those containing high-ascii characters according to RFC2047


 

fieldNamed:ifAbsent:

return the value of the field with the specified name. If there is more than one field, then return the first one


 

fieldsNamed:ifAbsent:

return a list of all fields with the given name


 

fieldsNamed:separatedBy:

return all fields with the specified name, concatenated together with separationString between each element. Return an empty string if no fields with the specified name are present


 

hasFieldNamed:


 

removeFieldNamed:

remove all fields with the specified name


 

rewriteFields:append:

Rewrite header fields. The body is not modified.
Each field's key and value is reported to aBlock. The block's return value is the replacement for the entire header line. Nil means don't change the line, empty means delete it. After all fields are processed, evaluate appendBlock and append the result to the header.


  initialize-release top  
 

body:

change the body


 

from:

Parse aString to initialize myself.


 

initialize

initialize as an empty message


 

setField:to:

set a field. If any field of the specified name exists, it will be overwritten


 

setField:toString:


  multipart top  
 

addAttachmentFrom:withName:

add an attachment, encoding with base64. aName is the option filename to encode


 

atomicParts

Answer all of the leaf parts of this message, including those of multipart included messages


 

attachmentSeparator


 

decoderClass


 

makeMultipart

if I am not multipart already, then become a multipart message with one part


 

parseParts

private -- parse the parts of the message and store them into a collection


 

parts


 

save

save the part to a file


  parsing top  
 

fieldsFrom:do:

Invoke the given block with each of the header fields from the given stream. The block arguments are the field name and value. The streams position is left right after the empty line separating header and body.


 

headerFieldsNamed:do:

Evalue aBlock once for each header field which matches fieldName. The block is valued with one parameter, the value of the field


 

readDateFrom:

Parse a date from the given stream and answer nil if the date can't be parsed. The date may be in any of the following forms:
<day> <monthName> <year> (5 April 1982; 5-APR-82)
<monthName> <day> <year> (April 5, 1982)
<monthNumber> <day> <year> (4/5/82)
In addition, the date may be preceded by the day of the week and an optional comma, such as:
Tue, November 14, 1989


 

reportField:to:

Evaluate the given block with the field name a value in the given field. Do nothing if the field is malformed.


 

skipWeekdayName:

If the given stream starts with a weekday name or its abbreviation, advance the stream to the first alphaNumeric character following the weekday name.


 

timeFrom:

Parse the date and time (rfc822) and answer the result as the number of seconds
since the start of 1980.


  printing/formatting top  
 

asSendableText

break lines in the given string into shorter lines


 

bodyTextFormatted

Answer a version of the text in my body suitable for display. This will parse multipart forms, decode HTML, and other such things


 

cleanedHeader

Reply with a cleaned up version email header. First show fields people would normally want to see (in a regular order for easy browsing), and then any other fields not explictly excluded


 

excerpt

Return a short excerpt of the text of the message


 

fieldsAsMimeHeader

return the entire header in proper MIME format


 

format

Replace the text of this message with a formatted version.


 

formattedText

Answer a version of my text suitable for display. This cleans up the header, decodes HTML, and things like that


 

printOn:

For text parts with no filename show: 'text/plain: first line of text...'
for attachments/filenamed parts show: 'attachment: filename.ext'


 

regenerateBodyFromParts

regenerate the message body from the multiple parts


 

regenerateText

regenerate the full text from the body and headers


 

viewBody

open a viewer on the body of this message


 

viewImageInBody


  testing top  
 

containsViewableImage


 

selfTest

For testing only: Check that this instance is well formed and makes sense


class methods
  instance creation top  
 

empty

return a message with no text and no header


 

from:

Initialize a new instance from the given string.


  preferences top  
 

omittedHeaderFields

Reply a list of fields to omit when displaying a nice simple message


  testing top  
 

selfTest


  utilities top  
 

dateStampNow

Return the current date and time formatted as a email Date: line


 

generateSeparator

generate a separator usable for making MIME multipart documents. A leading -- will *not* be included