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

Posts: 17
Registered: ‎08-06-2012
My Device: Curve 9320
My Carrier: Vodaphone

Issue sending Mail from Blackberry Device


Here is my code snippet to send mail in blackberry. I believe setting the host mail address is missing, that's why even though it shows mail sent and gets added to the 'Sent' folder, but actually the mail is not received by the recipient.


Message m = new Message();
   Folder folders[] = Session.getDefaultInstance().getStore().list(Folder.SENT);

 Address   a = new Address("brajak@gmail.com", "firstmail");

   Address[] addresses = {a};
   m.addRecipients(RecipientType.TO, addresses);
      m.setContent("A message for you...");
      m.setSubject("Email for you");
      Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(e));


Please help.



Sanghamitra Pati

Posts: 17,003
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Issue sending Mail from Blackberry Device

Your code is difficult to read when you use single-letter variables, i would suggest that you use speaking names, like "message" instead of "m".

Create the message in the sent folder by using new Message(sentfolder).
No need to specify an address array if you use only one element, you can use addRecipient to add a single address.

Instead of invoke use only Transport.send.

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter