BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 09-17-2009, 04:31 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Sep 2009
Model: 9530
PIN: N/A
Carrier: soft
Posts: 26
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default sending mail from BB simulator

Please Login to Remove!

HI All,

Am new to the BB Application Development, can any one help me in sending and receiving mail from BB simulator.

this has to be done programaticaly.

Please its very Urgent.


Thanks in Advance

Soma
Offline  
Old 09-17-2009, 08:24 AM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

See the file rimpublic.property file in the MDS/config directory.

Here you will see where you set up your email account info.
Offline  
Old 09-17-2009, 06:20 PM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Sep 2007
Model: 8100
PIN: N/A
Carrier: Vodafone
Posts: 18
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is some sample code to send an email programmatically to get you started:

Code:
public boolean SendEmail(String emailFrom, String emailTo, String subject, String messageData, String fileName, byte[] fileData)
{
        // create a multipart message
        Multipart mp = new Multipart();
        TextBodyPart tbp = new TextBodyPart(mp, messageData);
        mp.addBodyPart(tbp);

        SupportedAttachmentPart sap = new SupportedAttachmentPart(mp, "audio/amr", fileName, fileData);
        mp.addBodyPart(sap);
        
        // 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
       try 
       {
           Address toAdd = new Address(emailTo, emailTo);
           Address toAdds[] = new Address[1];
           toAdds[0] = toAdd;
           message.addRecipients(Message.RecipientType.TO, toAdds);
           message.setSubject(subject);
           message.setContent(mp);
           //sets priority
           //message.setPriority(Message.Priority.HIGH);
           net.rim.blackberry.api.mail.Transport.send(message);
           return true;
       } 
       catch (Exception e) 
       {
            return false;
       }
    }
Offline  
Old 09-17-2009, 07:50 PM   #4 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

Yes, what Kevin said.

AND, when you get that done, set up the rimpublic.properties file if you want the mail to go anywhere.

Offline  
Old 09-17-2009, 11:55 PM   #5 (permalink)
Knows Where the Search Button Is
 
Join Date: Sep 2009
Model: 9530
PIN: N/A
Carrier: soft
Posts: 26
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank u Guys i will Try this.
Offline  
Old 09-18-2009, 04:03 AM   #6 (permalink)
Knows Where the Search Button Is
 
Join Date: Sep 2009
Model: 9530
PIN: N/A
Carrier: soft
Posts: 26
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a lot Kevin.

Its Working...
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.