Change the contents of the message body and keep the attachments using a FolderListener

Hello

I need to change the content of specific e-mails when they are received on the device. I use a FolderListener to detect when the message arrives, and I'm able to edit the content of the message. The problem is, attachments are lost in the process, but I need to keep. I just want to change the body of the message.

Here is my code:

public void messagesAdded(FolderEvent e) {

  Message m = e.getMessage();
  Object content = m.getContent();

  if (content instanceof Multipart) {

    Multipart mp = (Multipart) content;

    for (int idx = 0; idx < mp.getCount(); idx++) {

      Object part = mp.getBodyPart(idx);                

      if (part instanceof TextBodyPart) {

        mp.removeBodyPart(idx);
        break;
      }
    }
    TextBodyPart tbp = new TextBodyPart(mp, _res.getString(MSG_MAIL_CONTENT));
    mp.addBodyPart(tbp);
    m.setContent(mp);
  }
}

Any idea?

Kind regards

Stone

Have you tried the cloning message? Then you can just copy the attachment to you original if it is lost.

Tags: BlackBerry Developers

Similar Questions

  • How will I know if my Airport Extreme has the latest firmware?  And (not related) how to change the password used to connect to my network?

    I think I bought the latest version of Airport Extreme.  It is the unit which is rectangular, is about 6 to 7 w., etc.  I have some basic questions that I do not understand:

    1. How will I know if I have the latest firmware for this device?  I read a few posts that make it sound as if it was just automatically updates.  Is this true?

    2. can someone tell me how to change the password used to connect to my wireless network?

    Thank you very much!

    Chris

    If a firmware update is available, AirPort Extreme flashes orange.

    The most up-to-date version of the firmware is 7.7.3.

    You can see what version you currently have the following on your Mac...

    Open Finder > Applications > utilities > AirPort Utility

    Click on the image of the AirPort Extreme

    Look for the Version

    If the new firmware was available, you will see a button update here

    To change the wireless network password...

    Click on edit in the window smaller than you watched just to check the firmware version

    Click on the Wireless tab at the top of the next window

    Go back / change the wireless password and enter a new password

    Do the same thing to check

    Click Update at the bottom right of the window and give the airport a minute full for restart

  • My Windows XP pro would not let me change the option 'Use the home screen', so I removed a vital .dll file. I can't start Windows now!

    My Windows XP pro would not let me change the "Use welcome screen" option under: user accounts/change the way users connect or power off.

    He gave a message to the effect (I forgot to write it!) "a recently installed program does not change this setting. Search in the file named "RtlGina2.dll for a clue. So as silly as I can be, I did a search, finds the file RtlGina2.dll in the Windows/System32 folder and cut and paste on my desk. My thought was to isolate this file to see if it will address the problem of not being able to change the option use Windows screen.

    Now, I can't run Windows! It gives a message that this file RtlGina2.dll is not found! Specifically, it says, User Interface failure. The UI for logon RtlGina2.dll DLL failed to load. Contact your system administrator to replace the DLL or restore the original dll.

    How can I replace the dll if I can't even get started? Help, please! I know just enough to get me in trouble I see.

    WyoPathfinder,
    Are you able to boot mode safe mode with command prompt?  If Yes, then you can search for the file "dir /s /a RtlGina2.dll" lists the location where you moved to.  Then you can just copy (path\filename) c:\Windows/System32\(filename)

    If you do not work in safe mode, then you can boot from a XP disc and go into the recovery console and do the same thing.

    Hope that helps. QQ learn manage!

  • Change the vmnic used by the service console

    Can someone help me change the vmic used by the concole service, when I write the command excfg, I get the message:

    excfg-vswitch - L vminc0 vSwitch0 "segmentation fault".

    Thanks to y using the year.

    AFAIK vmnic0 is assigned by default to vSwitch0.

    First, try it canceled with: esxcfg-vswitch - U vmnic0 vSwitch0

    I use the procedure below to delete vSwitch0 and create a service named TSV - cos console switch.

    esxcfg-vswif vswif0 d

    esxcfg-vswitch - del - pg = "Service Console" vSwitch0

    esxcfg-vswitch vSwitch0 d

    esxcfg-vswitch - TSV - cos

    esxcfg-vswitch - L vmnic0 TSV - cos

    esxcfg-vswitch-add-pg = "Service Console" TSV - cos

    esxcfg-vswif - a vswif0 Pei "Service Console"-i < ESXHOSTIP > - < ESXHOSTSUBNETMASK > n

    Arnim - van Lieshout

    -

  • I changed my password of gmail e-mail. How can I change the password used by Thunderbird to connect to gmail.

    I changed the password used to access my gmail account. Thunderbird still uses the old password to access the account. How can I change the password that is using Thunderbird. The last time this happened I ended up creating a new account to Thunderbird for gmail. Create the new Thunderbird account at least let me enter the new password. I don't really want to have three accounts of Thunderbird for the same gmail account.

    Please do not respond with suggestions on using password manager. I do not use it and do not want to start. I looked, and none of my Thunderbird passwords are displayed here. All I want to do is change the password in Thunderbird. If Thunderbird does not have a feature that allows you to change passwords, should be added.

    The link posted by Christ1 gives WRONG directions. In Thunderbird 24.4.0, is:
    Tools, Options, security, passwords, saved passwords

    Admittedly, in fact, you want that he SHOWS you the passwords, and then you can delete them.
    Once fact you check for mail, it will tell you, it didn't, and then you have the option to enter a new password.
    MUCH too complicated. Time to put the password and the ability to change, in the e-mail account options.

  • Change the headings used in Command Center?

    I was wondering if there is a way to change the elements used in the command center? For example, to replace the calendar with something else.

    Thank you

    There is currently no way to change the applications that are launched via app Droid Turbo command center. The clock, batteries and the Accu Weather apps are the main applications, and calendar via the "Pop out" are the only ones available.

    There are other applications on the game you might like better as the "Rings Digital Weather Clock" you might find more functional for a particular use from you.

    I hope this helps!

  • At the point of the map, how to change the font used

    Hello

    I want to change the font used in the bubble in Mappoint. I don't talk about boxing of text or the text size, I just want to change the police and use "Microsoft sans Serif".

    Is this possible?

    How to do?

    I used Windows 7,

    Best regards

    You can ask in the following forum because they are more likely to have relevant experts:

    Highway, streets and Trips, MapPoint .

  • How to change the rendering used for video playback in Windows Media Center Version 6 engine

    I usually use other media players, but I would like to first of all using Windows Media Center. However for the moment video playback is not good because of the weird colors (everything is displayed in black and Red instead of normal colors). When you use other media players, I use the Haali rendering engine which gives good results for video playback.

    Can you tell me how to change the rendering used by Windows Media Center?

    Also, I noticed the same weird color effect in Windows Media Player 11.

    Hi Woobee,

    1. What is the brand and model of the computer?

    2. what graphics card use on the computer?

    If you are using an Nvidia graphics card on the computer, in the Nvidia Desktop Manager, you will find an option for saturation to ensure it is set to 100%.

    And if you are any other graphics card on the computer and search for a similar option for saturation.

    If the previous step fails in Windows media player, so be sure that the hue and Saturation are defined by default.

    1. click on the arrow on the tabplaying , point to enhancements, and then clickcolor picker.

    2. do one of the following:

    1. to return to the default color, click thereset link.

    Also, make sure that the video settings are set by default.

    1. start the playback of a file.

    2. click on the arrow on the tabplaying , point to improvements, and then clickvideo settings.

    3. click onreset.

    Check also in Windows Media Center if the

    1. on theStart screen, go to tasks, click settings, clickgeneral, then Visual and sound effects.

    2. undercolors ensure that Windows media center standard is enabled.

    Turn off Visual and sound effects in Windows Media Center

    http://Windows.Microsoft.com/en-us/Windows-Vista/turn-off-Visual-and-sound-effects-in-Windows-Media-Center

    I hope this helps!

    Halima S - Microsoft technical support.

    Visit ourMicrosoft answers feedback Forum and let us know what you think.

  • I can't change the location using activation please

    I can't change the surprise using activation please

    Hello

    Sorry for the inconvenience caused.

    I suggest refer you to the link below on how to enable Windows 8.

    http://Windows.Microsoft.com/en-us/Windows-8/why-activate-Windows

    I hope this helps.

  • change the port used by apex 4.0

    Hello

    How can I change the port used by apex? For example, instead of 8080 I want to use 8081

    Thank you

    If you use OC4J, or any other application server, but you do not use the EPG you must reset the EPG

    exec dbms_xdb.sethttpport( 0 );
    
  • How can I change the color used by highlighting the e-mail messages

    How can I change the color highlighting the e-mail messages?

    Hi Hofstra64,

    If you talk about the highlight appears when you select an e-mail message, this is related to the "Highlight color" parameter in your general settings of OS X. More information can be found in the following link:

      

    Highlight color

      

    Choose the color that you want to see when you put in highlight or select items.

    OS X El Capitan: General preferences

    https://support.Apple.com/kb/PH21910

    Thank you for using communities Support from Apple!

  • How to change the name used when I downloaded more than 80 photos and classified with the wrong name

    I downloaded more than 80 pictures and inadvertently gave them all the wrong name. I know that I can change them one at a time, but how I can change the whole set at once?

    Open the folder the photos are in and go to... Edition / select all...
    Right-click the first picture of the highlighted (miniature group
    (or file name), and then from the menu choose... Name change.

    Enter a descriptive name for the group... Summer vacation
    .. .for example... also add a number...

    Summer vacation (10001)... jpg...

    Then left click... Enter... and Windows will be consecutively
    the remaining photos.

    Summer vacation (10001)... jpg
    Summer vacation (10002)... jpg
    Summer vacation (10003)... jpg

  • Is it possible to change the text using fonts Std of ITC Officina Sans Acrobat Pro?

    Is it possible to modify the test using std Officina Sans ITC fonts in Acrobat? I just downloaded acrobat and when I tried to change a few tests in the PDF file, a message popped up saying that the Std of ITC Officina without is not available or cannot be used in editing. Any ideas, downloads or similar fonts that I can use to solve this problem.

    Really need this font if not the whole PDF will look bad.

    Mise put on fast day, turns out I can't use Armada is a police. It seems that Acrobat Pro 11 has not all fonts I need.

    Discover the answer to Dov Isaacs in this forum announcement. Re: fully embedding the fonts in PDF format

    His comment:... Acrobat never uses the font incorporated to text editing - you must have the fonts installed on the system to make these changes. (emphasis added)

  • change the column using the trigger

    Hello
    is there any possibility or a way around to change a LONG column in a trigger BEFORE INSERT and BEFORE UPDATE?
    the scenario is like this.
    Old DOS applications (this is why we must use LONG in the Oracle), they inserting a record in Oracle (9.2.0.8 - HP UX).

    They are inserting ASCII characters that must be converted properly by Oracle using REPLACE.
    But the problem is that I can not handle a long TIME in relaxation.

    We have set the Oracle Client and Server NLS_LANG by using the same character set ISO-8859-1.
    but in some sort the ASCII character has managed to go to the Oracle, and it had not stored in the database.

    Use change will take more time than making a cleaning trash in the database.

    Is there a way around that you think.

    OK, you have your problem:

    Check this box:

    SQL> create table t
    (
       user_id        number,
       user_account   varchar2 (10),
       user_status    varchar2 (1),
       user_message   long
    )
    /
    Table created.
    
    SQL> create or replace trigger t_trg
       after insert
       on t
       for each row
    declare
       l_new_long   long;
    begin
       execute immediate '
           declare
             l long;
           begin
             select user_message into l from t@loopback where user_id = :1;
             update  t@loopback set user_message = replace(l, ''Some'', ''Some other'') where user_id = :1;
           end;
              ' using :new.user_id;
    end t_trg;
    /
    Trigger created.
    
    SQL> insert into t  values (1,  'michael', 'Y',  'Some Message')
    /
    1 row created.
    
    SQL> select * from t
    /
       USER_ID USER_ACCOUNT USER_STATUS USER_MESSAGE
    ---------- ------------ ----------- --------------------
             1 michael      Y           Some other Message
    1 row selected.
    
  • How to change the fonts used to display the list of emails on the homepage?

    Looking at my Inbox or other e-mail folder, the font used to display the list of emails in folders - gives me a headache.

    How can I change this font? Is there an add-on? Something in their profile?

    Ideally, I would like to change the background color of white also. (Perhaps the color on this page where I ask the question. "It's easy to read, the font and the color!)

    I've been a programmer in a past life, so I'm tech abreast. I am new to use Thunderbird (I used FF for several years.)

    Thank you!!

    Yes, to change the font, you can use this addon:

    Also, try to use themes:

Maybe you are looking for

  • typing in Safari

    I've got El Capitan 10.11.5 and safari 9.1.1 I can't type in the search field.  Amazon, Facebook, Wikipedia, etc.  Typing is laggy and AutoCorrect going nuts.  I often get the beach ball.  I erased from history, all caches and extensions.  I have upd

  • Since the upgrade to 10.11.4 won't open my app store.

    Since the upgrade to 10.11.4 will not load the app store my mac icon. It opens, but all I get is a spinning wheel.

  • Satellite C70D - Has: game lag due to the graphics chip?

    Hello I have laptop Toshiba Satellite C70D-A-11th week series 1.Unfortunately, I'm at the moment not really satisfied with the image... game is lagging because my graphics. My question is where you can find how much I consume the 4 GB. And where can

  • How to become a system administrator?

    I had problems with the video driver from New York. Sometimes I get the blue screen, explaining that there is a problem with nv4_disp. I was told to update the driver, but evertime I try, I get "network policy settings prevent you from using this web

  • Spare part for the fan T42p

    I want to order a spare for my T42p type 2373-C96 fan. The index of system parts to: http://support.Lenovo.com/en_US/product-and-parts/detail.page?&LegacyDocID=MIGR-46474 is a bit confusing, I couldn't find my model next to the listed parts fan desig