I’ve developed several apps in php and rails that deal with SMS.
If you have a GSM modem, you can use an application like Kannel
(kannel.org). Setup and configuration can be anywhere from very simple
to extremely frustrating depending on hardware support for your OS.
There are other services online that let you send SMS messages, but
they generally charge pennies per message for outgoing messages. If
you search for SMSC provider you will find several. Incoming SMS is
another story. There are so many restrictions with SMS messaging it
can be very expensive and complex to setup with a real SMSC service
company. I think the going rate for a 5 digit short code is somewhere
around $1000/month and vanity numbers are even higher. Sharing a short
code with someone is possible, but you are limited in the keywords you
can use etc. It appears to be a heavily regulated business.
The email route is probably your best bet for sending messages since it
costs you nothing. The downside is that some providers might block
these and you can’t always get a full 160 characters going through an
SMS email gateway. Using Kannel or a similar app for incoming
messages will let you receive messages at whatever rate your GSM
provider charges. You can set this up locally with a dynamic dns
service and then relay to your remote host.