SMS Messages with Windows Mobile 5.0
A while ago, I was playing around creating a bot, a Snarkier version of the Mobile Secretary Application . Well, it was late and I got sloppy. So basically, my little app sent out a text message to everyone on one of my company's Outlook distribution lists. I learned a lot that night.
So you've always been able to send SMS messages with Smartphone, but it's a lot easier now. Sending them isn't a big deal though. The cool thing is intercepting them. To that end, the Message Interceptor class makes it quite easy:
private
MessageInterceptor Interceptor;
Interceptor =
new MessageInterceptor(InterceptionAction.NotifyAndDelete, false);
Interceptor.MessageReceived +=
new MessageInterceptorEventHandler(Interceptor_MessageReceived);
void Interceptor_MessageReceived(object sender, MessageInterceptorEventArgs e)
{
SmsMessage IncomingMessage = (e.Message as SmsMessage);
String[] ImportantStuff = new String[]{"Dog pooping",
"Vista Launch",
"Would you care to explain THIS?",
"Vicodin ES",
"Camel Toe",
"Kim",
"Mom",
"EDC"};
foreach(String s in ImportantStuff){
if(IncomingMessage.Body.IndexOf(s)> -1){
SmsMessage OutgoingMessage = new SmsMessage(e.Message.From.Address, "This is the Cuckoobot, I'm handling Bill's messages, he'll be in touch shortly");
OutgoingMessage.Send();
//Yes, I know this isn't optimal - it's demo code.
}
else{
SmsMessage OutgoingMessage = new SmsMessage(e.Message.From.Address, "This is the Cuckoobot. Your message isn't important and will have to wait.");OutgoingMessage.Send();
}
}
}