Sending Email in BlackBerry
Sending Email in BlackBerry
-
Code:
Select all
-
import net.rim.blackberry.api.mail.Message;
import net.rim.blackberry.api.mail.Address;
// Create Message object
Message message = new Message(folder_sent);
// Set Subject of the Email
message.setSubject("Test Message");
// Set Body of the Email
message.setContent("Hi! This is a test Email...");
// Add Recipients of the Email
Address recs[] = new Address[2];
recs[0] = new Address("email1@something.com","Recipient 1 Name");
recs[1] = new Address("email2@example.com","Recipient 2 Name");
message.addRecipients(Message.RecipientType.TO, recs)
-
Code:
Select all
-
import net.rim.blackberry.api.mail.Transport;
try {
Transport.send(message);
} catch(MessagingException me) {
System.out.println(me.getMessage());
}
-
tommy
- Posts: 100
- Joined: Thu Dec 02, 2010 9:25 pm