Blackberry:发送邮件

Sending Email in BlackBerry

by tommy » Sat Jun 18, 2011 11:58 am

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("[email protected]","Recipient 1 Name");
   recs[1] = new Address("[email protected]","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

你可能感兴趣的:(Blackberry:发送邮件)