blackberry

Detect whether email is sent or not + Blackberry


I am facing a little problem with Transport.send(msg) function of Blackberry API. In my application I need to send a sound file. But I want to know what happens if the device loses connectivity in middle of sending the email.

I tried to enclose the Transport.send(msg) call within try catch block but it never throws exception even if I manually turn off the Wi-Fi from the device while the file is being sent. If by any chance email could not be sent I want to show the user a dialog saying that email could not be sent.


Solution

  • You can catch SendFailedException which is thrown when a message cannot be sent.

    You can monitor the messages by calling getStatus() on a message which should return you the values given here