Email isn’t old school

With all this focus on new media, we mustn't forget the old. Here's a tech talk to help you remember.

With all this focus on new media, we mustn’t forget the old – and here’s a tech talk to help you remember. Email in particular. It rocks. The world pretty much runs on email. Okay, perhaps a few web services too. But email is still up there!

So it makes sense to know how to use it on Force.com. When I wrote the this article on integration I added email as an integration option. Want to integrate with an old mainframe? Chuck in a few email handlers. Want to integrate with a new human on his palmtop? Chuck in a few email handlers.

And it’s not that difficult really. Here’s the Apex Code that can serve as the basis of an email handler – something that intercepts incoming emails:

global class HandleWhims implements Messaging.InboundEmailHandler {
global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email,
Messaging.InboundEnvelope env) {
Messaging.InboundEmailResult result= newMessaging.InboundEmailResult();
System.debug('from email address:' + email.fromAddress);
System.debug('email body:' + email.plainTextBody);
System.debug('email subject:' + email.subject);
return result;
}
}

Just a little configuration (setting up an email address and associating it with the handler) is about all else you need. Of course you can also send email, and more.

We just had a nice little webinar on the topic, Tech Talk: Introduction to the Email Services on Force.com – check it out for an introduction.

Published
July 13, 2009
Topics:

Leave your comments...

Email isn’t old school