One of the nice aspects of working in a universitary environment is, that you can take advance of many nice little things. For example, you can send free SMS via the Switch Mailgateway (http://www.switch.ch/mail/)
To do so, I wrote a simple PHP script, wich enables me to send SMS via a little Textbox through a Website. I used the PEAR Framework to implement the mailing- function. For readability I stripped away the HTML forms and JavaScript functions, wich limited the form’s capacity to the SMS- usual 160 characters.
<?php require_once('Mail.php'); if (isset($_POST['smsor_message'])) { $options = array ( 'host' => 'smtp.unibas.ch', 'auth' => false, ); $mailer = Mail::factory('smtp', $options); if (true === PEAR::isError($mailer)) { die ($mailer->getMessage()); } $headers = array( 'From' => 'me@unibas.ch', 'To' => $_POST['smsor_to']."@sms.switch.ch", ); $res = $mailer->send($_POST['smsor_to']."@sms.switch.ch",
$headers,
$_POST['smsor_message']); if (true === PEAR::isError($res)) { die ($res->getMessage()); } echo "Message <br>\n<i>".$_POST['smsor_message']."</i><br>\n
sent to <i>".$_POST['smsor_to']."</i><br>\n"; echo "<br><hr><br>"; } ?>