How can I get a list of all recipients of e-mail effectively

Hello

If I want to get a list of everyone in the "To", "CC" and "BCC" fields, is it possible more effectively than below?

Currently, I am doing this (this is the "ELSE", I am talking here):

public void messagesAdded(FolderEvent e)
    {
        logWriter.log("Email message "+(e.getMessage().isInbound()?"received":"sent"));
        emailMessage = e.getMessage();

        boolean isInbound = (e.getMessage().isInbound()?true:false);

        if(inbound)
        {
            // There'll only be 1 "from" person, I might possibly handle other recipients later
            String name = emailMessage.getFrom().getName();
            name = name.substring(1,emailMessage.getFrom().getName().length()-1);
        }
        else
        {
                // Retrieve all types of recipient
                Address[] sentTo  = emailMessage.getRecipients(Message.RecipientType.TO);
                Address[] sentCc  = emailMessage.getRecipients(Message.RecipientType.CC);
                Address[] sentBcc = emailMessage.getRecipients(Message.RecipientType.BCC);          

                // Loops through the arrays and pulls out Recipient names
                StringBuffer allRecipientsNames = new StringBuffer();
                StringBuffer allRecipientsEmails = new StringBuffer();

                for (int count=0 ; count < sentTo.length ; count++)
                {
                    allRecipientsEmails.append(sentTo[count].getAddr());
                    allRecipientsEmails.append(";");
                    allRecipientsNames.append(sentTo[count].getName().substring(1, sentTo[count].getName().length()-1));
                    allRecipientsNames.append(";"); // This "name" substring is seperated by a ";"
                }
                for (int count=0 ; count < sentCc.length ; count++)
                {
                    allRecipientsEmails.append(sentCc[count].getAddr());
                    allRecipientsEmails.append(";");
                    allRecipientsNames.append(sentCc[count].getName().substring(1, sentCc[count].getName().length()-1));
                    allRecipientsNames.append(";"); // This "name" substring is seperated by a ";"
                }
                for (int count=0 ; count < sentBcc.length ; count++)
                {
                    allRecipientsEmails.append(sentBcc[count].getAddr());
                    allRecipientsEmails.append(";");
                    allRecipientsNames.append(sentBcc[count].getName().substring(1, sentBcc[count].getName().length()-1));
                    allRecipientsNames.append(";"); // This "name" substring is seperated by a ";"
                }
        }
    }

This looks so ineffective! Possible, this is the only way to do it, but I thought maybe shoot all Types of recipients:

Address[] recipients = emailMessage.getRecipients(Message.RecipientType.TO && Message.RecipientType.CC && Message.RecipientType.BCC);

Something like that would be possible? This is (obviously) my first time using the electronic portion of the blackberry dev and I'm pretty new to blackberry as a whole, so sorry if there's something obvious I'm missing here.

Thanks for the help!

a BB is not a Pocket Calculator, you have some power of treatment on your hands. unless you do big calculations he nott will be any impact on the device.

If optimization is not necessary it mainly reduces legibility and makes it harder for other people to maintain your code

Tags: BlackBerry Developers

Similar Questions

  • How can I get a list of all IEEE 1394 defined in MAX cameras?

    I can use the DAQmx_System:Global_Channels property node to get all global DAQ channels defined in MAX, but is it possible to do something similar to get all the names of camera?  I am after all especially the IEEE-1394 cameras, but would be happy with a list of all the cameras to begin with.  Is there a property node that I'm over looking?

    Hi, Christopfer,

    You can use IMAQdx list Cameras.vi for a list of all the cameras. (of course, here I assumed that IMAQdx used to connect to the IEEE-1394 camera).

    Another way is utility CameraValidator.exe with key/enum - this will also list the available cameras.

    Best regards

    Andrey.

  • How can I get a list of all links/URLS used in all emails Eloqua?

    I try to have a report, list, or the export of all links/URLS never used in e-mail Eloqua (about 250) assets. Is there a quicker, more precise and perhaps automated to do this other than to pick up manually?

    Basically the desired result is a list of all links/URLS used in an Excel worksheet, additional information is a plus.

    If there are ways through the API, it is also welcomed.

    The Web site is subject to a few changes and we would like to keep all links living in them the remapping to the end server.

    Hi all

    First two ideas come to mind:

    1. go to Insight and run the Email clicks link ventilation report to see the links and clicks used in various emails. This will allow you to search for links to the last 730 days. However, note that if you have an abundance of links, the report may timeout. This is why the guests page, you may need to search specifically for a range of dates (month or two at a time) until you have all the expected results.

    2. using other APIs. The live docs for Rest API include the ability to search hyperlinks in emails. For instructions to access the direct documentation, see the Oracle Support Document 2078514.1 (how access rest and bulk API Live Docs) to: https://support.oracle.com/epmos/faces/DocumentDisplay?id=2078514.1. Once inside the live docs do the following:

    • Click on liabilities
    • Click/assets/hyperlinks
    • Expand the Hypertext GET/assets/links
    • Entry 'Complete' in depth to make sure that you check out the URL for each hyperlink

    Let me know if it helps!

    Best regards

    Matt Goodman

  • How can I get a list of all the routers wireless, I plugged in the past and remove them?

    My laptop is Windows Vista.  Last year I took it to different places where I connected to different wireless routers.  My laptop keeps the list (and passwords) of these routers somewhere on the hard drive.  I would like to remove some (actually most) of these routers of this list.  But I can't find this list of the last wireless connections make the deletion.  It was available in Windows XP.  It is not available in Windows Vista?  How can I make my computer to forget information on connections without wire used in the past?

    Type "network" in the box to start the search. Click on "network and sharing Center."  Click "Manage wireless networks" in the menu on the left. Click the network that you want to remove, and then click the "Remove" button that appears.

  • How can I get a list of all my favorites?

    Hello

    I'm using Firefox 23.0.1 version. I'm trying to save my list of bookmarks to HTML as a backup copy. Can you please tell me how I can do?

    Kind regards
    Teresa

    Hello

    Firefox automatically creates backups of your bookmarks, which can be useful if your bookmarks are lost or missing. To retrieve them, follow the instructions below.

    1. Use one of the following methods to open the bookmarks library window:

      • Click the Firefox button to open the menu and click on bookmarks.
      • Click on the menu of bookmarks and click show all bookmarks.
    2. At the top of the library window, click on the "Import and backup" menu and select restore.
    3. Click 'save '.
    4. You can now save your bookmarks in JSON format.

    For more information, see the article restore bookmarks from a backup or move them to another computer . For alternatives, see the article of recover lost or missing bookmarks .

    This solve your problems? Please report to us!

    Thank you.

  • How can I get my tab open all when update my firefox?

    now I'm still using very old Firefox 3.6.12 and I want to upgrede. I always using "save and exit" to my tab all open when quitting and not using bookmarks. total approximately 300 + tab open.
    I already try to upgrade my tab and once all is lost. and because of that I do system restore and reintall with old new.

    How can I get my tab open all when update my firefox?
    Sorry my English is a mess...

    already installed, but all the connection site became logout.
    and when right-clicking, page list too...
    and when I choose open in new tab or windown and something else happened...
    loading longer become page (already stop the other tabs)
    and when I block a text/link and drag it to the input tab or the navigation text or input search nothing happenend too...

    and when I close it, no other choice to save and exit...

    Edit:

    Resolved:

    1. Save and quit already solved with the help of addons.

    2. right click and drag the problem is already solved, I close firefox and restart.

    unsolved:

    1. all the connection still in State of disconnection site (can't stay as before connection).

    Edit:

    unsolved:

    2. on option, the images block list is missing.

  • How can I get a list of paths of subset xmlIndex?

    Hello

    How can I get a list of paths of subset xmlIndex?

    I was wondering if there is a query that is able to give me the list of subset a xmlindex unstructured update paths. I want that the groups included and excluded paths.

    Create index.

    -------------------------------------------------------------------------------------------------------------------

    CREATE HR INDEXES. Ixml_TB_XML1 on HR.tb_xml (XML) INDEXTYPE IS XDB. XMLINDEX PARAMETERS ("PATHS (INCLUDE (//article

    Article/physical_entity/communicator/person/compiler/causal_agent/language

    Article/physical_entity/communicator/person/compiler/causal_agent/language/writer/header/title

    Article / / language

    Article/wee/physical_entity/person/physicist/entity/colleague/adult/scientist/professional/educator/partner/academician/causal_agent/header/categories

    Article/bdy/s/p/dash

    Article/bdy/s/p/list/entry

    Article/physical_entity/person/causal_agent/adult/professional/lawyer/header/bdy

    Article/bdy/dry/ss1/p

    ))')

    /

    -----------------------------------------------------------------------------------------------------

    If exists such request I would get an example, please.

    Kind regards

    Daiane

    Hello

    The info you are looking for are available via {s/n |} ALL THE | USER dictionary views} _XML_INDEXES.

    for example

    SQL > select ex_or_include, x.xpath

    2 of user_xml_indexes I

    3, xmltable ('/ path/paths/settings ' in passing i.parameters)

    path of 4 columns xpath varchar2 (4000) '.'

    5       ) x

    6 where index-name = "IXML_TB_XML1".

    7;

    XPATH EX_OR_INCLUDE

    ------------- --------------------------------------------------------------------------------

    INCLUDE some //article

    INCLUDE the //article/physical_entity/communicator/person/compiler/causal_agent/language

    INCLUDE the //article/physical_entity/communicator/person/compiler/causal_agent/language/wri

    INCLUDE the //article//language

    INCLUDE the //article/pee/physical_entity/person/physicist/entity/colleague/adult/scientist/

    INCLUDE the //article/bdy/sec/p/indent

    INCLUDE the //article/bdy/sec/p/list/entry

    INCLUDE the //article/physical_entity/person/causal_agent/adult/professional/lawyer/header/b

    INCLUDE the //article/bdy/sec/ss1/p

    9 selected lines

  • How can I make a list of all bookmarks as my homepage?

    How can I make a list of all bookmarks as my homepage?

    You can set one of these pages as startup page:

    • chrome://browser/content/places/places. XUL
    • chrome://browser/content/bookmarks/bookmarksPanel.XUL

    The first one opens the Manager of bookmarks (library) and the second the bookmarks that see you in the box to Favorites (Ctrl + B; View > sidebars)

  • iPhone 6 s more. The music will not play an entire album. Just of repetitions the first track.  How can I get it to play all tracks in order?

    iPhone 6 s more. The music will not play an entire album. Just of repetitions the first track.  How can I get it to play all tracks in order?

    In-app music, press the "mini player" (the narrow ribbon at the bottom showing the song that is playing).  Which opens upward from the view of work full screen of the song being played - down at the bottom of this screen are icons for shuffle and repeat, press Repeat until the gray background disappears.

  • How can I get my contacts and all the other stuff I had on the old email?

    Original title: I changed my email because they said my old email was invalid... How can I get my contacts and all the other stuff I had on the old email? They said, it has been deleted

    If my email isn't valid how I used it?

    Hello

    1. which email account you are referring to?

    2. What is the version of Windows installed on the computer? For example, Windows 7, Vista

    Please answer these questions and provide additional information so that we can better guide you.

  • How can I get WMP to find all my songs that are stored on an external hard drive?

    I bought an external hard drive to store music for my product and WMP adds only about 30% of the songs to the Player library.  Some are wma and some are in mp3 format (added to the library and which must still be added).  I tried to uncheck Read-only after reading some responses online, but who did not stick and nothing changed.  How can I get WMP to find all my songs?

    I couldn't change them to read-only.  Fortunately after the computer restarts several times it work itself.

    Thanks for all the tips!

  • How can I get a list of jobs that are planned for the days of the future

    How can I get a list of jobs that are planned for the days of the future?

    In a previous article, I found a query that lists the scheduled tasks that are already running. Can I get a similar request for the future days which is compiled?

    Hi sreedevir,

    SELECT jobmst.jobmst_prntname, jobmst.jobmst_name, jobrun.*

    FROM jobrun JOIN jobmst ON jobmst.jobmst_id = jobrun.jobmst_id -joining tables jobmst and jobrun

    WHERE jobrun_proddt > = dateadd (dd, 1, datediff (dd, getdate())) 0, -future dates

    AND jobmst.jobmst_type = 2 -given jobs (and not groups)

    ORDER BY 1, 2 -Sort by name of the parent, then by task name

    Feel free to make any changes to your reporting needs

    ARO

    The Derrick

  • How can I generate a list of all the albums I have in my music library

    How can I generate a list of all the albums I have in my music library

    See http://answers.microsoft.com/en-us/windows/forum/windows_7-sound/how-to-print-a-list-of-items-in-the-window-media/6490fe4f-bb0e-4afa-97ca-3ce58c3aaeba

    but, if you only do this several times, you can use this procedure instead:

    Open a command prompt in your folder music [shift-right click on the name of the folder in the Windows Explorer & select a window of commands here]

    Run the dir/ad/b /s > AlbumList.txt

    Then open the text file in Word and he put away: -.

    Replaceyourusernamewith Nothing \Music\ C:\Users\

    Replace-with ^ t [the code of the tab]

    Select all, convert table to use the trademarks of the tab as column separators

    Select column 1 [the artists], and delete

    If there is garbage in all 3 columns - go just delete the columns thus

    That should leave a unique list of album names

  • How can I get a list of the applications that I paid for with my subscription?

    How can I get a list of the applications that I paid for with my subscription?

    Which subscription you have... specialized photography or cloud together?

    Cloud Plans https://creative.adobe.com/plans

    -Special photography Plan includes Photoshop & Lightroom and Bridge & Mobile Lightroom

    -What is in the set of Cloud http://www.adobe.com/creativecloud/catalog/desktop.html

  • How can I get the list of data stores in a cluster data store?

    How can I get the list of data stores in a cluster data store? I mean the command line option.

    Hello

    by command line, you mean PowerCLI?

    If so, you can display data with this warehouses:

    Get-DatastoreCluster-name DSClustername | Get-Datastore

    Tim

    Edit: Moved the thread to the PowerCLI community

Maybe you are looking for

  • Satellite A660-10W does not not after recovery

    Hello! I just picked up my phone to default factory settings. all is ok so far... After you install the utilities 55 pilots and other things (automatically after the first start) it restarted and today when it starts normal or in all other modes exce

  • License Manager for applications built in LabVIEW

    What I have is a licensing system to add to applications built in LabVIEW that works more or less like a volume, or as FlexLM license server, where a customer is allowed to so many instances/seats of a program.  Most of what I found looking around my

  • error code 80070490 unable to get new updates since Feb. 27

    Not much more I can add, last change was the update of definition for windows defender KB915597 and Outlook 2003 Junk mail Filter 977713

  • Fatal error HP Color LaserJet CM2320 MFP 1406

    Please help I got this error during installation of HP Color LaserJet CM2320 MFP

  • Fuze does not recognize the .ogg files?

    Hello I just bought a 4 GB fuze; one of the main reasons was supposed to ogg vorbis playback support. Somehow I feel now, I was wrong. Well well, according to the FAQ: What operating system (OS) are you using? (Windows, Mac, Linux,?) Linux What versi