1) Contact to a network operator which may give access to its SMSC (short message service centre). Then it is possible to send messages to certain IP address using some protocol such as Nokia's CIMD2. To do this some CGI scripts or other applications are needed to handle the actual event.
2) Connect a mobile phone to a PC, which is running a webserver. In this case some CGI scripts or other applications are needed to handle the message sending. The script/application must control the phone using AT commands.