tags:

views:

208

answers:

2

Hi -

We'd like to send a single email which has "multiple contents" attached. Scenario is that we'd like one content to be displayed if the email is read using a Blackberry and another content displayed if the email is read in a desktop email client. (Blackberry content would be just text, other devices should read the HTML content instead)

I'm off to do some research, but I wondered if anyone could tell me if this just doesn't sound possible.

Muddled illustration

Mail
content 1 = text/plain device=blackberry
content 2 = text/html device=everything else

We're deevloping using Java/Spring, not that that is relevant for the general question here.

Many thanks.

A: 

You can do that using multipart/alternative subtype within multipart message.

You will NOT be able to dictate which part gets opened by what mail client, however - it's up to client to decide.

As far as implementation goes, take a look at MimeMultipart to get you started. Spring email integration does not support multipart/alternative messages directly as far as I know.

ChssPly76
Ok thanks, we actually want to force the blackberry to open the text version (end user request I'm afraid). hmmm.
ashbyp
A: 

You need to include the multipart/alternative tag in the e-mail. In my version of the Blackberry software (this will vary) it attempts to open the e-mail in the html version with a menu option to get the plain text version.

It is a good practice in general with complex HTML e-mail and helpful for many e-mail clients, but you don't get the kind of fine grain control you are looking for.

Yishai
Thanks- I guess I'll add the text attachment and see what options the Blackberry gives the user - I wonder if it would be possible to put a <a href="XXX">Text Version</a> link at the top of the mail. The XXX would need to open the text attachment on the email reader rather than go to a server though.
ashbyp
I tried a couple of things:i) I added a mutltipart message, text and html versions with the multipart alternative setting. Result was that the blackberry displayed the html version after stripping out the html tags. Fail.ii) I added an inline attachment of the form <a href='cid:textReport'>Blackberry friendly version</a>. BlackBerry does not understand the cid: tag. Fail.So I guess I am going to have to resort to two emails.
ashbyp
@ashbyp, Although the blackberry may display the e-mail poorly, it should have a menu option to get the plain text. That may or may not work for your use case.
Yishai
Apparently our users are not capable of using the menu system on the BlackBerry - they are busy Traders, don't ya know...The message must be there and beautifully formatted for them.Thanks for the advice though.
ashbyp