[Pharo-project] Issue 3352 in pharo: Proposal (with code) for adding multipart/alternative MIME support to MailMessage and WAEmailMessage

pharo at googlecode.com pharo at googlecode.com
Sun Nov 28 22:35:08 CET 2010

Status: New
Owner: ----

New issue 3352 by tony.fleig: Proposal (with code) for adding  
multipart/alternative MIME support to MailMessage and WAEmailMessage

Pharo image: Pharo
Pharo core version: 1.1-11411
Virtual machine used: n/a
Class browser used (if applicable): n/a

I added the attached methods to MailMessage and modified one method in  
WAEmailMessage to allow me to create and send multipart/alternative and  
multipart/mixed email messages from Pharo/Seaside.

My need was to send text/plain and text/html multipart/alternative messages  
for account registration confirmation.

SUnit tests are included for all the new methods.

I don't know precisely how to contribute this code. I have signed no  
agreement yet. I'm hoping that by posting it the feature may find its way  
into Pharo at some point. If the code is unacceptable for some reason, I am  
willing to make whatever changes are needed.

Example using the new functionality:

| msg ssmsg |

msg := TFMailMessage empty.
     addAlternativePart: 'This is plain text.'
         contentType: 'text/plain';
     addAlternativePart: '<html><head></head><body>This is  
         contentType: 'text/html'.

ssmsg := msg
     seasideMailMessageFrom: 'fleig at mailserver.com'
     to: 'example at mailserver.com'
     subject: 'Test multipart message'.

ssmsg plainMessage.


'From: fleig at mailserver.com
To: example at mailserver.com
Subject: Test multipart message
Date: Sun, 28 Nov 2010 12:46:18 -0800
content-type: multipart/alternative;boundary="==CelesteAttachment50460=="
mime-version: 1.0

Content-type: text/plain

This is plain text.
Content-type: text/html

<html><head></head><body>This is html.</body></html>

	MailMessage-addAlternativePart.st  257 bytes
	MailMessage-seasideMailMessageFromtosubject.st  578 bytes
	MailMessage-makeMultipartwith.st  888 bytes
	WAStringEmailBodyTest-testMultipart.st  1.4 KB
	MailMessage-addPartcontentType.st  446 bytes
	MailMessage-addMixedPartcontentType.st  456 bytes
	MailMessage-addAlternativePartcontentType.st  468 bytes
	MailMessage-addMixedPart.st  243 bytes

More information about the Pharo-project mailing list