Welcome!

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

Reply
Developer
ddev1702
Posts: 64
Registered: ‎04-25-2012
My Device: 9000
My Carrier: Airtel

cant send mail from my application to my mail id

Hi,

i am stuck.....

actually,i have to send a mail to my gmail id,using my simulator.i am using the following code.

 

Store st = Session.getDefaultInstance().getStore();
Folder[] folders = st.list(Folder.SENT);
Folder sentFolder = folders[0];

Message msg = new Message(sentFolder);

Address toList[] = new Address[1];

try {
toList[0] = new Address("ddev1702@gmail.com","dipanwita");
}
catch (AddressException aeTo) {
System.out.println(" Exception in AddressException-1 : "+aeTo.toString());
}

try {
msg.addRecipients(Message.RecipientType.TO,toList); // add To, CC, BCC
}
catch (MessagingException meTo) {
System.out.println(" Exception in MessageException-1 : "+meTo.toString());
}

try {
Address from = new Address("siva_sadanala@satyam.com","sadanala"); // Sender Details
msg.setFrom(from);
}
catch (AddressException aeFrom) {
System.out.println(" Exception in AddressException-2 : "+aeFrom.toString());
}

msg.setSubject("Test Mail From Black Berry."); // For Subject

try {
msg.setContent("Hi Syam. Test Message From Black Berry.");
}
catch (MessagingException meC) {
System.out.println(" Exception in MessageException-2 : "+meC.getMessage());
}

try {
Transport.send(msg);
System.out.println(" Email Sent successfully.");
}
catch (MessagingException meS) {
System.out.println(" Exception in MessageException-3 : "+meS.getMessage());
}
System.exit(0);
}

 


but ,its not working .is there any changes i have to made in settings for simulator?

i have to use simulator to send mail to my gmail account.plz help me out.

d.dev
Please use plain text.
Developer
simon_hain
Posts: 15,806
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: cant send mail from my application to my mail id

did you use the email simulator service?
without it the simulator does not support sending and receiving mails.
----------------------------------------------------------
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
Please use plain text.
Developer
ddev1702
Posts: 64
Registered: ‎04-25-2012
My Device: 9000
My Carrier: Airtel

Re: cant send mail from my application to my mail id

Can you send me how to do this with ESS?I DNT HAVE ANY IDEA !!!:smileyindifferent::smileysad:

d.dev
Please use plain text.
Developer
avinash_kumar_ispg_in
Posts: 172
Registered: ‎01-02-2012
My Device: 8520 curve
My Carrier: compny

Re: cant send mail from my application to my mail id

Hi

 

 install it in to the device and check.

 

or

you can add this line last and and install in to device and click menu button ,there will be send option select and click to send.

 

Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(msg));

 

May be this will be helpfull to you.

 

 

 

 

 

if you found this as solution fill free to accept as solution.

Please use plain text.
Developer
ddev1702
Posts: 64
Registered: ‎04-25-2012
My Device: 9000
My Carrier: Airtel

Re: cant send mail from my application to my mail id

i have no device.i have to do this through simulator ...please help me out

d.dev
Please use plain text.
Developer
simon_hain
Posts: 15,806
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: cant send mail from my application to my mail id

try this:
http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800792/800982/How_to_...
----------------------------------------------------------
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
Please use plain text.