Package net.rim.blackberry.api.mail

Examples of net.rim.blackberry.api.mail.TextBodyPart


        Multipart mp = new Multipart();

        //create the file
        SupportedAttachmentPart sap = new SupportedAttachmentPart(mp,"application/x-example",attachment,data);

        TextBodyPart tbp = new TextBodyPart(mp, body);

        //add the file to the multipart
        mp.addBodyPart(tbp);
        mp.addBodyPart(sap);
View Full Code Here


                    }
                }
            } else {

                Multipart mp = new Multipart();
                TextBodyPart bodypart = new TextBodyPart(mp);
                int bodyPartIndex = 0;

                if (body.getActualContent() != null) {

                    String encoding = body.getContentTransferEncoding();

                    bodypart.setContentType(body.getContentType());

                    String content = null;
                    if (encoding != null && encoding.trim().equalsIgnoreCase("base64")){
                        content = new String(Base64.decode(body.getActualContent().getBytes()));
                    } else {
                        content = body.getActualContent();
                    }

                    bodypart.setContent(content);
                    mp.addBodyPart(bodypart,bodyPartIndex);
                    ++bodyPartIndex;
                }

                for (int i = 0; i < attachment.size(); i++) {
View Full Code Here

                new SupportedAttachmentPart(multipart,
                        "text/calendar; component=vevent", "event.ics", bouts
                                .toByteArray());

        // Add attachment to multipart
        multipart.addBodyPart(new TextBodyPart(multipart, bouts.toString()));
        multipart.addBodyPart(bodypart);

        try {
            // Set multipart as message content
            msg.setContent(multipart);
View Full Code Here

        final SupportedAttachmentPart sap =
                new SupportedAttachmentPart(mp, MIMETypeAssociations
                        .getMIMEType(fileHolder.getFileName()), fileHolder
                        .getFileName(), stream);

        final TextBodyPart tbp = new TextBodyPart(mp, messageData);
        mp.addBodyPart(tbp);
        mp.addBodyPart(sap);
        final Folder folders[] =
                Session.getDefaultInstance().getStore().list(Folder.SENT);
        final Message message = new Message(folders[0]);
View Full Code Here

        for (int index = 0; index < multipart.getCount(); index++) {
            final BodyPart bodyPart = multipart.getBodyPart(index);

            // If this body part is text then display all of it
            if (bodyPart instanceof TextBodyPart) {
                final TextBodyPart textBodyPart = (TextBodyPart) bodyPart;

                // If there are missing parts of the text, try to retrieve the
                // rest of it.
                if (textBodyPart.hasMore()) {
                    try {
                        Transport.more(textBodyPart, true);
                    } catch (final Exception e) {
                        BlackBerryMailDemo
                                .errorDialog("Transport.more(BodyPart, boolean) threw "
                                        + e.toString());
                    }
                }
                final String plainText = (String) textBodyPart.getContent();

                // Display the plain text, using an EditField if the message is
                // editable or a RichTextField if it is not editable. Note: this
                // does not add any empty fields.
                if (plainText.length() != 0) {
View Full Code Here

            final int size = bodyFields.size();
            final Multipart content = new Multipart();
            for (int fieldNo = 0; fieldNo < size; fieldNo++) {
                final TextField body =
                        (TextField) bodyFields.elementAt(fieldNo);
                content.addBodyPart(new TextBodyPart(content, body.getText()));
            }
            try {
                message.setContent(content);
            } catch (final MessagingException e) {
                BlackBerryMailDemo
View Full Code Here

TOP

Related Classes of net.rim.blackberry.api.mail.TextBodyPart

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.