'From Squeak3.0 of 4 February 2001 [latest update: #3414] on 12 February 2001 at 9:10:45 am'! "Change Set: CelesteAttachmentFix Date: 12 February 2001 Author: Mike Rutenberg Simple fixes to Celeste to make attachments work in the new version 3.0 Does two things (1) Fixes a bug which caused valid MIME attachments to not be recognized (2) Allows you to send properly formatted email attachments which have long filenames This change set modifies three existing methods "! !MailMessage methodsFor: 'parsing' stamp: 'mdr 2/11/2001 17:58'! reportField: aString to: aBlock "Evaluate the given block with the field name a value in the given field. Do nothing if the field is malformed." | s fieldName fieldValue | (aString includes: $:) ifFalse: [^self]. s _ ReadStream on: aString. fieldName _ (s upTo: $:) asLowercase. "fieldname must be lowercase" fieldValue _ s upToEnd withBlanksTrimmed. fieldValue isEmpty ifFalse: [aBlock value: fieldName value: fieldValue]. ! ! !MailMessage methodsFor: 'multipart' stamp: 'mdr 2/9/2001 14:05'! asTextEncodingNewPart: aStream named: aName "Return a multipart mime-formatted text otherwise equivalent to this message, with the contents of aStream attached (base64 encoded). Note: MIME headers are very sensitive to extra white space. Only change the spacing if you know what you are doing. Small changes can make attachments unreadable." | strm continuationBreak | strm _ WriteStream on: (String new: 100). strm nextPutAll: self asMultipartText. "We write long MIME header lines broken up over several lines to work around a celeste bug where long header lines get formatted -mdr" "We use this to carefully & legally break up a MIME header line" continuationBreak _ String cr, ' '. strm nextPutAll: 'Content-Type: application/octet-stream;'; nextPutAll: continuationBreak; nextPutAll: 'name="' , aName , '"'; cr; nextPutAll: 'Content-Disposition: attachment;'; nextPutAll: continuationBreak; nextPutAll: 'filename="' , aName , '"'; cr; nextPutAll: 'Content-Transfer-Encoding: base64'; cr; cr. Base64MimeConverter new dataStream: aStream; mimeStream: strm; mimeEncode. strm cr; nextPutAll: '--' , self attachmentSeparator; cr. ^ strm contents! ! !MailMessage methodsFor: 'multipart' stamp: 'ls 2/10/2001 13:07'! attachmentSeparator ^(self fields at: 'content-type') parameters at: 'boundary' ! !