always get null for incoming email message bodies

Hi all

Someone please give me assistance? I only get the body of email null message with my code and I don't know what's the problem with him. I'm on OS 4.7 and OS5.0, both gave me the same result.

My application add an option to the e-mail menu to allow the user to perform text-to-speech on his email. It works well on the composition of e-mail, but it does not work on an incoming e-mail where the code always get a message body null instead of what is really in the email. The function that I used to recover the body of the email is getEmailBodyText() and here is the list:

Note that I had no problem to get about the e-mail. I don't have any problem in getting the body of the message.

Thank you for your help.

/ * START: FUNCTION TO DECODE THE EMAIL MESSAGE BODY TEXT * /.

Private boolean _hasSupportedAttachment;
Private boolean _hasUnsupportedAttachment;
private String _plainTextMessage = "";
private String _htmlMessage = "";

String getEmailBodyText (net.rim.blackberry.api.mail.Message message) {}
                                           
String retBodyText = null;
_hasSupportedAttachment = false;
_hasUnsupportedAttachment = false;
_plainTextMessage = "";
_htmlMessage = "";

findEmailBody (message.getContent ());
    
if(_hasSupportedAttachment || _hasUnsupportedAttachment) {}
retBodyText = _plainTextMessage + ', ' + _htmlMessage + ' notice: this message contains an attachment.
}
else {}
retBodyText = _plainTextMessage + ', ' + _htmlMessage;
}

Return retBodyText;
}

This method reads in an e-mail message to find the body of the email.
private void findEmailBody (Object obj)
{
Reset the flags of the attachment.
_hasSupportedAttachment = false;
_hasUnsupportedAttachment = false;

If (obj instanceof multipart)
{
Several party mp = (Multipart) obj;

Check out all the parts in the multipart message.
for (int count = 0; count)< mp.getcount();="">
{
findEmailBody (mp.getBodyPart (count));
}
}
else if (obj instanceof TextBodyPart)
{
This message only has a body of text.
The PTB TextBodyPart = (TextBodyPart) obj;
readEmailBody (BSC);
}
else if (obj instanceof MimeBodyPart)
{
MimeBodyPart mbp = (MimeBodyPart) obj;

If (mbp.getContentType () .indexOf (ContentType.TYPE_TEXT_HTML_STRING)! = - 1).
{
The message has no attachments.
Read the body of the e-mail, which can contain a
TexBodyPart, MimeBodyPart or both.
readEmailBody (mbp);
}
ElseIf (mbp.getContentType () .equals (ContentType.TYPE_MULTIPART_MIXED_STRING) |)
mbp.getContentType () .equals (ContentType.TYPE_MULTIPART_ALTERNATIVE_STRING))
{
The message includes attachments, or we are in the
top level of the message. Dig up the body.
Extract all the parts in the MimeBodyPart message.
findEmailBody (mbp.getContent ());
}
    
}
else if (obj instanceof SupportedAttachmentPart)
{
It is an attachment supported.
_hasSupportedAttachment = true;
}
else if (obj instanceof UnsupportedAttachmentPart)
{
It is an attachment that is not supported.
_hasUnsupportedAttachment = true;
}
}

Private Sub readEmailBody (TextBodyPart, PTB)
{
It is the body of plain text.
_plainTextMessage = (string) tbp.getContent ();

Determine if the entire body text is present.
If (tbp.hasMore () &! tbp.moreRequestSent ())
{
To do this, ask the rest of the message.
Try
{
Transport.More (BSC (body part), true);
System.out.println ("request more plain text in the body of the message. Reopen the screen to see it once more have been received. ») ;
}
catch (Exception ex)
{
System.Err.println ("Exception:" + ex.toString ());
}
}
}

Displays the body HTML or plain text of the message.
Private Sub readEmailBody (MimeBodyPart mbp)
{
Extract the content of the message.
Object obj = mbp.getContent ();
String mimeType = mbp.getContentType ();
String body = null;

Determine if the data returned is a string or a byte array.
If the BlackBerry is capable of converting HTML content
in a string, then string must be returned. If
the encoding is not supported a byte array is returned
allow your application to work with the raw data.

If (obj instanceof String)
{
body = body (String);
}
else if (obj instanceof byte [])
{
body = new String ((byte[]) obj);
}

If (mimeType.indexOf (ContentType.TYPE_TEXT_PLAIN_STRING)! = - 1).
{
It is the body of plain text.
_plainTextMessage = body;

Determine if the entire body text is present.
If (mbp.hasMore () &! mbp.moreRequestSent ())
{
To do this, ask the rest of the message.
Try
{
Transport.More (mbp (body part), true);
System.out.println ("request more plain text in the body of the message. Reopen the screen to see it once more have been received. ») ;
}
catch (Exception ex)
{
System.Err.println ("Exception:" + ex.toString ());
}
}
}
ElseIf (mimeType.indexOf (ContentType.TYPE_TEXT_HTML_STRING)! = - 1).
{
It is the HTML part of the message body.
_htmlMessage = body;

Determine if the whole of the HTML body is present.
If (mbp.hasMore () &! mbp.moreRequestSent ())
{
To do this, ask the rest of the message.
Try
{
Transport.More (mbp (body part), true);
System.out.println ("asking more than the body of the message HTML.") Reopen the screen to see it once more have been received. ») ;
}
catch (Exception ex)
{
System.Err.println ("Exception:" + ex.toString ());
}
}
}
}
/ * END: FUNCTION TO DECODE THE EMAIL MESSAGE BODY TEXT * /.

@redmapleleaf

I see...

try this one in order to test even with the Simulator.

How to-send and receive e-mail messages via the simulator of BlackBerry email offline server
Article number: DB-00576

http://www.BlackBerry.com/knowledgecenterpublic/Li velink.exe/fetch/2000/348583/800792/800982/How_to...

hope that your application works. see you soon

Tags: BlackBerry Developers

Similar Questions

  • Guest Audio of Smartphones blackBerry for incoming emails

    Question: Is there a way to get an audio prompt for incoming emails? Thank you

    EDIT: Title changed

    You can change ringtones for emails

    Go to menu, profiles, do scroll to the tip, normal or that one is active and go to each mail account and change the ringtone.

  • I downloaded Acrobat Pro and paying by monthly subscription, but when I open a document I always get a window with a message 27 days remaining in your trial period. How to get rid of this message?

    I downloaded Acrobat Pro and paying by monthly subscription, but when I open a document I always get a window with a message 27 days remaining in your trial period. How to get rid of this message?

    Sign out of your account of cloud... Restart your computer... Connect to your paid account of cloud

    -If you have more than one email, but of course you use linked to your subscription

    -Connect using http://helpx.adobe.com/x-productkb/policy-pricing/account-password-sign-faq.html

    -https://helpx.adobe.com/creative-cloud/help/sign-in-out-activate-apps.html

    -http://helpx.adobe.com/x-productkb/policy-pricing/activation-network-issues.html

    -https://helpx.adobe.com/x-productkb/policy-pricing/activate-deactivate-products.html

  • Firebug shows always GET NULL - 404 not found

    It happened every time where the basic slideshow is used, any kind of site.

    Ffirebug / google developer tool both shows that the error...

    It is only occur with specific Slideshow module

    example here:

    http://lovemyweb.NET/bug.html

    Hi kolazero,

    We have seen this come up several times, so I thought I would take the time to approach this as directly as possible. I go into a lot of details so that you can understand exactly why this is happening, but more importantly, take far it must be this question is harmless and can be ignored.

    Now, we do not say that lightly. Normally errors popping up on your sites are from the very high priority for us and we are studying carefully, but in this case, it is a kind of "design error" error. We are indeed aware that this error on some browsers, we know where in the code, it happens, and we know why it happens. Indeed, in this code, the engineer who performed this left a very large comment to someone else who came later by explaining exactly what is happening, and why it happens so that there is no confusion on this issue.

    Let's get technical for a minute here. Slideshows are a bit special because they are a set of images where only 1 image will load at the same time (in addition to thumbnails), so handle us a little differently as we do other images. When you place an image in the page by simply using the file > Place command, we simply that insert on the page and let the browser manages the loading of that image on its own initiative. However, for slideshows, we know that there are slightly different rules, that we can use to improve the loading time and user experience, and we take advantage of this in a special code that we use. If we let the browser to load the images, and you had your slideshow on random, then the browser will load the first image, then the second, then the third, but you might see them in reverse order, which means that you can look at the pictures that have not yet loaded. To avoid this problem, we control the loading of images, the order in which they are responsible and when the slide show can go to the next slide, and we do it in a way optimized for your particular slideshow and configuration.

    Now, when load us the images in this way, we do by loading images on the screen, them wait to the end and they plugged into the right location. This is a very common technique, and many sites and libraries out there do this same thing or something similar. When we do, some browsers have problems with loading just one image after another, so we use a trick and 'clear' the images between each load. This saves some headaches for the old browser bugs and also allows to load a lot of large images without your site slows down users of the machine more than necessary. However, unfortunately a side effect of this is that on some modern browsers, when 'clear us' the images, they will try to load between it state called 'null '. This translates the error you see in the console of your browser. The browser tries to load something that does not exist on the server and so will show the error that there are no (404).

    This issue has been around for a while, and it's one we know certainly. It's on our backlog to investigate alternatives to this approach and make improvements in this area in general, but unfortunately we did not have time to circle back around this particular problem. We do not realize that it can be a little scary to see your site, and we want to git rid of it rather sooner than later, but given the priorities on other bugs, features and areas of application, he did not on a plate of engineers to look again. And given our resources and our priorities at the moment, I'm not sure I can say when we will have a fix for this, however, once again, sooner rather than later, it's what we prefer. In the meantime, as I said earlier, this error will not cause your site not bad and can only be ignored.

    If all goes well, which clears some things. And if you have any questions about this, feel free to ask and I will do my best to answer.

    Thank you

    Andrew

    Muse QE

  • Vista Windows Mail: sounds of alert for incoming email, but do not see

    Hello, I noticed recently that when our Windows Mail (Vista) plays the alert for incoming e-mails, sometimes we do not find the item of electronic mail.  It is not in the box of reception, junk e-mail or Deleted, or highlighted as spam.  Suggestions, please?

    Thank you.

    Hi DarrenSampson,

    It seems that you have the same for another activity on the computer.

    See the link below to check if you have assigned the same for more several activities

    Change the sounds of the computer
    http://Windows.Microsoft.com/en-us/Windows-Vista/change-computer-sounds

  • Alerts for text, email, messaging, blackBerry Smartphones voice etc. disappeared

    There is nothing extraordinary, but I no longer get alerts for sms or mms, e-mail and virtually everything that uses alerts.   I checked and double checked the option for each and every settings seem normal.  Normal is that they are set up as they would be working.  Thanks in advance for any help.  Its much appreciated.  Once again thanks...

    Hi and welcome to the Forums!

    Each time a random strange behavior or slow creeps, the first thing to do is a battery pop reboot. With power ON, remove the hood back and remove the battery. Wait a minute, then replace the battery and cover. Power on and wait patiently through the long reboot - about 5 minutes. See if things return to functioning. Like all computing devices, BB suffers from memory leaks and others... with a hard reboot is the best remedy.

    Best!

  • I don't get an arrow for incoming emails

    I used to get an arrow when I have incoming messages.  Somehow that works more...?

    I have no recollection of this behavior in any version of OS X Mail.

    Mail in the Dock icon will have a badge indicating the number of unread messages. It is the only indication that I know.

  • After installing the last "Update Agent" I can always get updates for Windows 7 Home Premium?

    After installing the last "Update Agent" can't always updated for

    Windows 7 Home Premium?  After 2 days in dealing with this problem, I came to help?

    Someone please give me an answer!

    E-mail address is removed from the privacy *.

    Hello

    Please contact the Microsoft community.

    As you said that you are not able to get new updates of windows on the computer.

    I would like to ask some questions about your request:

    1. When was the last time that you install the windows desktop update?

    2. You receive an error message from the updates?

    3. You use any third-party antivirus on the computer?

    4. Did you do any change on your computer before the show?

    Please refer to the reference to the link below for " " " The problems with installing updates".

    http://Windows.Microsoft.com/en-us/Windows/troubleshoot-problems-installing-updates#1TC=Windows-7

    Please get back to us with the information in short so that we can help you further.

  • BlackBerry Smartphones always shows 1 unread in email message

    I use BB9860 (OS7). After a few days running, now still I receive 1 message as unread in the e-mail.

    I even open individually all the mails in the inbox and marked as read. But always showing 1 message as unread. If new 5 messages is delivered to the Inbox, and then it shows like 6 message as unread. After reading messages 5 the altar dates back to 1 message as unread.

    I would like to know how to clear this message.

    Follow the advice of gnarled and then remove the battery while your phone is on and replace it a few seconds later. It worked for me.

    Let us know if it works for you.

  • How can I return display html for incoming emails?

    I installed the module to encrypt my emails. I uninstalled it and now all emails are coming in plain text format. I want to return HTML display.

    View (Alt - V) - body of the Message as - HTML Original

  • Sound for incoming emails with the text of the specific object?

    I want emails coming to make an alert sound and some can't. I know that I can give senders the VIP list and have the phone makes a sound when their emails is available, but I want to base this decision on a specific string in the subject/body of the email, don't not from which it comes. Is this possible with iOS?

    NO.

  • How can I get the nulls for the weeks later

    Hi all

    When I run this code, I get records up to the current week.
    How can I view the output that I get nulls for the weeks later. (with the help of the v_numOfWeeks variable in the code)

    Thank you
    Vikram
    DECLARE
       v_query VARCHAR2(4000); 
       TYPE ref_cursor IS REF CURSOR; 
       v_refcur ref_cursor;
       v_sum NUMBER; 
       v_id NUMBER; 
       v_name VARCHAR2(1000); 
       v_weeknum NUMBER; 
       v_pernum NUMBER; 
       v_numOfWeeks NUMBER := 5; 
    BEGIN 
    v_query := ' SELECT SUM(product_bkg), postn_id, postn_tbl.postn_name, b.week_num, b.period_num
                              FROM ops_cv_extract b, (SELECT row_id, desc_text postn_name
                          FROM s_postn) postn_tbl
                          WHERE lvl_6_id = 5767
                          AND fiscal_year = 2008
                          AND b.week_num < 4
                          AND b.period_num = 3
                          AND b.postn_id = TO_NUMBER(postn_tbl.row_id)
                          GROUP BY postn_id, postn_tbl.postn_name, b.week_num, b.period_num
                          ORDER BY  postn_tbl.postn_name, b.week_num';
                          
    OPEN v_refcur FOR v_query;
    
    LOOP 
       FETCH v_refcur INTO v_sum, v_id, v_name, v_weeknum, v_pernum;
       EXIT WHEN v_refcur%notfound; 
       dbms_output.put_line('P'|| v_pernum||'W'|| v_weeknum||' '||v_name||' '||v_sum); 
    END LOOP; 
    END;
    /
    
    This is the output when I execute this code. 
    
    P3W1 COMM CNTRL ISAM 213 26961.61
    P3W2 COMM CNTRL ISAM 213 12870.4
    P3W3 COMM CNTRL ISAM 213 245.88
    P3W1 COMM CNTRL ISAM 273 72831.2
    P3W2 COMM CNTRL ISAM 273 8739.38
    P3W3 COMM CNTRL ISAM 273 3764.92
    P3W1 COMM CNTRL TAM 213 49844
    P3W2 COMM CNTRL TAM 213 20515.17
    P3W3 COMM CNTRL TAM 213 16167.46
    P3W2 COMM CNTRL TAM 216 12561.4
    P3W3 COMM CNTRL TAM 216 2027.1
    P3W1 COMM CNTRL TAM 273 -3336.71
    P3W2 COMM CNTRL TAM 273 -1376.68
    P3W3 COMM CNTRL TAM 273 19707.42
    P3W1 Damon Walters -609.07
    P3W2 Damon Walters 30030.24
    P3W3 Damon Walters 37475.1
    
    This is the output I'd like to get
    
    P3W1 COMM CNTRL ISAM 213 26961.61
    P3W2 COMM CNTRL ISAM 213 12870.4
    P3W3 COMM CNTRL ISAM 213 245.88
    P3W4 COMM CNTRL ISAM 213 
    P3W5 COMM CNTRL ISAM 213 
    P3W1 COMM CNTRL ISAM 273 72831.2
    P3W2 COMM CNTRL ISAM 273 8739.38
    P3W3 COMM CNTRL ISAM 273 3764.92
    P3W4 COMM CNTRL ISAM 273 
    P3W5 COMM CNTRL ISAM 273 
    P3W1 COMM CNTRL TAM 213 49844
    P3W2 COMM CNTRL TAM 213 20515.17
    P3W3 COMM CNTRL TAM 213 16167.46
    P3W4 COMM CNTRL TAM 213 
    P3W5 COMM CNTRL TAM 213 
    P3W1 COMM CNTRL TAM 273 -3336.71
    P3W2 COMM CNTRL TAM 273 -1376.68
    P3W3 COMM CNTRL TAM 273 19707.42
    P3W4 COMM CNTRL TAM 273 
    P3W5 COMM CNTRL TAM 273 
    P3W1 Damon Walters -609.07
    P3W2 Damon Walters 30030.24
    P3W3 Damon Walters 37475.1
    P3W4 Damon Walters 
    P3W5 Damon Walters 
    Published by: polasa on October 28, 2008 18:42

    Hello

    The subquery dum has 1 to 5 hard coded values:

    (
     44                select 1 week_num from dual
     45                union all
     46                select 2 from dual
     47                union all
     48                select 3 from dual
     49                union all
     50                select 4 from dual
     51                union all
     52                select 5 from dual
     53              ) dum ,
     
    

    Instead, use the following syntax, which produces the values from 1 to n:

    (
        SELECT  LEVEL  AS week_num
        FROM    dual
        CONNECT BY  LEVEL <= n
    )  dum,
    

    n may be any numeric expression, including a scalar subquery.

  • Exact time on incoming emails.

    How can I get time on incoming emails at the same time I have on my computer the daylight Standard time?

    Asaunders Hey,

    What program do you use to check your emails?

    To change the time zone in the incoming emails, you must change the time zone of your e-mail account.

    Diana D
    Microsoft Answers Support Engineer

    If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • Incoming emails from unknown clients are ignored

    Hello

    I have a problem with incoming emails. When Infra receives any email (new or upgrade) and does not correspond to a client, instead of creating a new customer it throw the e-mail and a new entry appears in the log of activity with this code: "error: Email sender is not a valid user to process the request." Error code = 0 ". I know that the automatic creation of new customers is the standard feature, so I don't know why it does not work as you wish.

    I have no active stored procedure and the default logging agent for incoming emails have all permissions in its role of security configuration management. I'm working on the VSM 9.0.9.

    Thank you

    I believe you can simply create a new call with unregistered sender (actually the sender in this case will be registered as a new customer).

    If I am right, it is impossible to update the registration of existing with email from unknown call.

  • Get null while trying to access the child of the element

    I have a custom component based on the Web and inside this canvas, I have a panel with id = 'main '.  The problem is whenever I try to access main from a Set accessor method within the component, I get null. for example

    public function set Content(newValue:String):void

    {

    If (newValue! = null)

    this.mainPanel.title = newValue;

    }

    Why am I mistake to attempt to access a null reference? Help please.

    OK, so you use content as a setter.

    The question is WHEN this property is set for the first time. IK you might "postpone" it until the layout is created, then you should be able to access main which will have already been initialized. You can do this by using the event creationComplete on your application.

    Just to be sure: your Panel is not inside a viewstack and tabNavigator or so?

    Dany

Maybe you are looking for

  • Firefox has error message when you try to download, why?

    This is the message I get when I try to download anything on Firefox: "/Volumes/Firefox/ww+kyT9X.pdf.part could not be saved, because you cannot change the contents of this folder."Change the properties of the folder and try again, or try saving in a

  • Reset Toshiba e-store account - 33021

    Hi, need a note reset for account 33021 After update to E_1.1.00, I get only a blank screen or the 70.jt1.c Impressum Please reset my account my e-mail is: [email protected] Post edited by: juliesmom

  • I get this error when loading Firefox? He [code] $pendingLocations is undefined - 2, is there a solution to this? Pls

    The problem started a few weeks before and only occurs when it seems to be associated with Java Script but can't do anything present in the error etc. files? Has anyone else encountered this problem

  • Vista drivers - when?

    I understand that support Toshiba engineers are unable to read this forum, but I'm still creating a separate thread on this subject in the hope someone from Toshiba here will one day and see how many people are in need of drivers vista for computers

  • Abandoned Dm1 now won't start up

    My son fell from his laptop. It froze and it turned it off until I could get a look. It starts but hangs on the windows start page. I took the battery and tried to reset several times without success. Is there something else I could try or should I t