Help Center
Local Navigation
- Integrating with BlackBerry Device Software applications
- Message list
- Create a new blank SMS text message
- Create a new populated text message
- Create a new blank MMS message
- Create a new blank email message
- Create a new populated email message
- Create a new blank PIN message
- Create a new populated PIN message
- Receive a message notification
- Add a listener to the message store
- Add a listener to the message store for batch updates
- Add a listener to a folder
- Retrieve the total count of unread email messages in all folders in the store
- Open a message
- Retrieving the body of an email message
- Notify a BlackBerry device application that an email message is about to be sent
- Notify a BlackBerry device application that an MMS message is about to be sent
- Notify a BlackBerry device application that an SMS message is about to be sent
- Send a message
- Reply to a message
- Forward a message
- Work with message folders
- Attachments
- Calendar
- Contact list
- Task list
- Phone
- BlackBerry Browser
- Menu items
- Glossary
- Provide feedback
- Document revision history
- Legal notice
BlackBerry Manuals & Help
>
Developer Documentation
>
Java Development Guides and API Reference
>
Development Guide
Integration - BlackBerry Java Application - 5.0
Forward a message
- Import the required classes and interfaces.
import net.rim.blackberry.api.mail.Address; import net.rim.blackberry.api.mail.Message; import net.rim.blackberry.api.mail.MessagingException; import net.rim.blackberry.api.mail.Session; import net.rim.blackberry.api.mail.Transport;
- Invoke Message.forward() on an existing Message object. The subject line of a forwarded message is set automatically to FW:original_subject.
Message fwdmsg = msg.forward();
- Create an array of addresses.
Address toList[] = new Address[1];
- Add a new Address object to the array.
toList[0]= new Address("ming.li@example.com", "Ming Li"); - Invoke Message.addRecipients(int, Address[]) to add recipients to the Message.
fwdmsg.addRecipients(Message.RecipientType.TO, toList);
- Invoke Message,setContent(String) to set the content of the message that appears before the original message.
try { fwdmsg.setContent("This is a forwarded message."); } catch(MessagingException e) { System.out.println(e.getMessage()); } - Invoke Session.getTransport() and store the returned object in a variable of type Transport. The Transport object represents the messaging transport protocol.
Transport trans = Session.getTransport();
- Invoke Transport.send(Message).
try { trans.send(fwdmsg); } catch(MessagingException e) { System.out.println(e.getMessage()); }
Next topic: Work with message folders
Previous topic: Reply to a message