Any idea how to write program to send SMS (Short MEssage Sending)

I have two gateways to GSM network in my plant and would like to send SMS
via it.For sure one can connect to them via RS232 but what next.? Where can
I find any materials regarding this topic?