tags:

views:

121

answers:

3

Hai guys, I am sending sms to my clients via my application..... Suppose if am sending a msg to 100 mobile numbers , one of it happens to be a non existing mob no .... How to skip that no alone and send rest of them..... I use a try catch block in the method when the msg cant be delievered it goes to catch and the rest of the numbers cant be sent.... Give me an idea how this can be done...

+8  A: 

Sounds like you are using something like this:

try {
    foreach(string number in numbers) {
        // send sms here
    }
}
catch()
{
    // do error handling here
}

Do it like this:

foreach(string number in numbers) {
    try {
        // send sms here
    }
    catch() { 
        // do error handling here
    }
}
J. Random Coder
7 up votes for that?? >_<
Omnipresent
A: 

chk the mobilenumber before send msg and if it is mobilenumber u just send.

anto
A: 

You need to do a "look up" on the number, usually the Aggregator you use will have this service

Phill Pafford