How to Send Email through Simulator in blackberry

If you are using Blackberry Java Eclipse Plugins then follow the steps.

Step-1:   a) Sending Email Without Attachment.

//Get the Store from the default mail Session.
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);
Address recipients[] = new Address[1];

recipients[0]= new Address(“”, “testmail”);

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

//set a subject for the message
msg.setSubject(“Test email”);

//sets the body of the message
msg.setContent(“This is a test email from my BlackBerry device”);

//sets priority

//send the message

Dialog.alert(“Email sent successfully..”);

catch (Exception me)

b) Sending Email With Attachment:-

//create a multipart
Multipart mp = new Multipart();

//data for the content of the file
String fileData = “just a simple test n just a simple test”;
String messageData = “WelCome”;

//create the file
SupportedAttachmentPart sap = new
SupportedAttachmentPart(mp,”text/txt”,”test.txt”, fileData.getBytes());

TextBodyPart tbp = new TextBodyPart(mp,messageData);

//add the message and file to the multipart

//create a message in the sent items folder
Folder[] folders = Session.getDefaultInstance().getStore().list(Folder.SENT);

Message message = new Message(folders[0]);

//add recipients to the message and send
Address toAdd = new Address(“”,”smita”);
Address[] toAdds = new Address[1];
toAdds[0] = toAdd;
Dialog.alert(“Email sent successfully..”);

catch (Exception e)


Step-2:  Follow this path


and run “load.bat” file.

fill the required things for example email id, incomming – outgoing server name. and click Load Test.The Load Test Window will open.

Step-3: Run your application.

By using this we can send our email on any account like gmail,yahoo,etc.through simulator.

Thank you.




Need more help?

Hi there, was your problem or query resolved? If not & need more assistance, please do reach out to us at, we'll be more than delighted to help. Nanostuffs has 7+ years of extensive Salesforce & iOS/Android experience.
Holler Box