Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Programmatically send a PIN message

by Retired ‎02-16-2010 12:01 PM - edited ‎02-17-2010 03:44 PM (8,711 Views)


This article applies to the following:

  • BlackBerry® wireless devices based on Java™
  • BlackBerry Device Software 4.0 and higher


The code sample below explains how to programmatically send a personal identification number (PIN) message from one BlackBerry device to another device that has PIN 20000000. This code sample uses the net.rim.blackberry.api.mail package.

Store store = Session.getDefaultInstance().getStore();

//retrieve the sent folder
Folder[] folders = store.list(Folder.SENT);
Folder sentfolder = folders[0];

//create a new message and store it in the sent folder
Message msg = new Message(sentfolder);
PINAddress recipients[] = new PINAddress[1];

//create a pin address with destination address of 20000000
recipients[0]= new PINAddress("20000000", "Robert");

catch (AddressException ae)

//add the recipient list to the message
msg.addRecipients(Message.RecipientType.TO, recipients);

//set a subject for the message
msg.setSubject("Test pin message");

//sets the body of the message
msg.setContent("This is a test pin message from my
BlackBerry Wireless Handheld");

//send the message

catch (MessagingException me)

Additional Information

This is not supported in BlackBerry Device Software 3.8 and earlier, and cannot be reproduced on the device simulators.

by Developer
on ‎04-12-2011 08:42 AM

I get error stating "Email permission denied" in simulator.. Help me solve this issue..

Users Online
Currently online: 32 members 2,556 guests
Please welcome our newest community members: