Status: New
Owner: ----
New issue 3352 by tony.fleig: Proposal (with code) for adding
multipart/alternative MIME support to MailMessage and WAEmailMessage
http://code.google.com/p/pharo/issues/detail?id=3352
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.
msg
addAlternativePart: 'This is plain text.'
contentType: 'text/plain';
addAlternativePart: '<html><head></head><body>This is
html.</body></html>'
contentType: 'text/html'.
ssmsg := msg
seasideMailMessageFrom: '[email protected]'
to: '[email protected]'
subject: 'Test multipart message'.
ssmsg plainMessage.
Produces:
'From: [email protected]
To: [email protected]
Subject: Test multipart message
Date: Sun, 28 Nov 2010 12:46:18 -0800
content-type: multipart/alternative;boundary="==CelesteAttachment50460=="
mime-version: 1.0
--==CelesteAttachment50460==
Content-type: text/plain
This is plain text.
--==CelesteAttachment50460==
Content-type: text/html
<html><head></head><body>This is html.</body></html>
--==CelesteAttachment50460==--
'
Attachments:
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