If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
Trusted Contributor
jijoac
Posts: 105
Registered: ‎02-02-2011
My Device: Bold 9900
My Carrier: Airtel

how to get " from address " from a send message

I want to get the from address of the message i send,

for that am using the following code

 

        public void messagesAdded( FolderEvent e )

        {                     

                        final Message m = e.getMessage();           

                        if ( m != null && !m.isInbound() )

                        {                                                     

                                String from = "";                                                                            

                                Address addrf = m.getFrom();


                                if (addrf != null)                   

                                {                     

                                       from = addrf.getAddr();                   

                                }                                        

                       }                                       

         }     

 

  but the  m.getFrom() returns null     for outgoing messages

 

 (it returns from address if it is an incomming message)

 

 

Please use plain text.
Developer
PoojaMaheshwari
Posts: 141
Registered: ‎02-10-2010
My Device: 9500
My Carrier: Airtel

Re: how to get " from address " from a send message

Try using:

 

Message.getAllHeaders() and then iterate through the Enumeration to check value corresponding to "FROM" header tag.

 

Refer to:

http://www.blackberry.com/developers/docs/4.6.0api/net/rim/blackberry/api/mail/Header.html

 

Please use plain text.
Trusted Contributor
jijoac
Posts: 105
Registered: ‎02-02-2011
My Device: Bold 9900
My Carrier: Airtel

Re: how to get " from address " from a send message

thanks for your reply,

 

I checked with Message.getAllHeaders() of outgoing mails

 

but now also I got message-id, to, subject and Date

Please use plain text.