Sending E-mail from BB simulator 9800, urgent help
Please Login to Remove!
hai friends...!
i have to send the order details via e-mail from the simulator as part of my project..!
here is my code:
Store store = Session.getDefaultInstance().getStore();
Folder[] folders = store.list(Folder.SENT);
Folder sentfolder = folders[0];
Message msg = new Message(sentfolder);
Address tolist = null;
try
{
//Address tolist[] = new Address[1];
tolist = new Address(objTo.getChoice(objTo.getSelectedIndex()). toString(), "");
}
catch(AddressException e)
{
System.out.println(e.toString());
}
try
{
msg.addRecipient(Message.RecipientType.TO, tolist);
}
catch (MessagingException e)
{
System.out.println(e.toString());
}
if(!objCc.getChoice(objCc.getSelectedIndex()).toSt ring().equals(""))
{
Address cclist = null;
try
{
//Address tolist[] = new Address[1];
cclist = new Address(objCc.getChoice(objCc.getSelectedIndex()). toString(), "");
}
catch(AddressException e)
{
System.out.println(e.toString());
}
try
{
msg.addRecipient(Message.RecipientType.CC, cclist);
}
catch (MessagingException e)
{
System.out.println(e.toString());
}
}
if(!objBcc.getChoice(objBcc.getSelectedIndex()).to String().equals(""))
{
Address bcclist = null;
try
{
//Address tolist[] = new Address[1];
bcclist = new Address(objBcc.getChoice(objBcc.getSelectedIndex() ).toString(), "");
}
catch(AddressException e)
{
System.out.println(e.toString());
}
try
{
msg.addRecipient(Message.RecipientType.BCC, bcclist);
}
catch (MessagingException e)
{
System.out.println(e.toString());
}
}
try
{
Address from = new Address("my email address", "my name");
msg.setFrom(from);
}
catch(AddressException e)
{
System.err.println(e.getMessage());
}
try
{
msg.setSubject(bsSubject.getText());
msg.setContent(txtBody.getText());
Transport.send(msg);
Status.show("message sent", 1500);
UiApplication.getUiApplication().popScreen(UiAppli cation.getUiApplication().getActiveScreen());
}
catch(MessagingException m)
{
System.err.println(m.getMessage());
}
when i debug the code,the code is working properly...! code is executing line by line in a proper manner..!
but the email has not been delivered to the To, Cc,Bcc addresses.
could you anyone please help on this issue? i have tested in BB Simulator 9800, using Eclipse plug-in.
i opened my mail account from the BB simulator's default browser, and was able to send the e-mail to another address.
thanks!
|