Sending a text message via php (issue)

I’ve been using a friends code to send an sms message via php. The only issue is that on receiving the message it gives out the hosting servers name. Now this I know can lead to a security issue. So am I’m turning to you guys to see what is it that I’ve missed.

This code uses the mail function of PHP
The default sub is set to TestingText

Here is the general form:

 <form id="sms" name="sms" method="post" action="send.php">
<table width="400">
  <tr>
    <td align="right" valign="top">From:</td>
    <td align="left"><input name="from" type="text" id="from" size="30" /></td>
  </tr>
  <tr>
    <td align="right" valign="top">To:</td>
    <td align="left"><input name="to" type="text" id="to" size="30" /></td>
  </tr>
  <tr>
    <td align="right" valign="top">Carrier:</td>
    <td align="left"><select name="carrier" id="carrier">
      <option value="verizon">Verizon</option>
      <option value="tmobile">T-Mobile</option>
   <option value="sprint">Sprint</option>
   <option value="att">AT&amp;T</option>
   <option value="virgin">Virgin Mobile</option>
    </select></td>
  </tr>
  <tr>
    <td align="right" valign="top">Message:</td>
    <td align="left"><textarea name="message" cols="40" rows="5" id="message"></textarea></td>
  </tr>
  <tr>
    <td colspan="2" align="right"><input type="submit" name="Submit" value="Submit" /></td>
    </tr>
</table>
</form>

And here is the php code:


 <?php
$from = $_POST['from'];
$to = $_POST['to'];
$carrier = $_POST['carrier'];
$message = stripslashes($_POST['message']);

if ((empty($from)) || (empty($to)) || (empty($message))) {
echo"Fail";
}

else if ($carrier == "verizon") {
$formatted_number = $to."@vtext.com";
mail("$formatted_number", "TestingText", "$message");

echo"Success";
}

else if ($carrier == "tmobile") {
$formatted_number = $to."@tomomail.net";
mail("$formatted_number", "TestingText", "$message");

echo"Success";
}

else if ($carrier == "sprint") {
$formatted_number = $to."@messaging.sprintpcs.com";
mail("$formatted_number", "TestingText", "$message");

echo"Success";
}

else if ($carrier == "att") {
$formatted_number = $to."@txt.att.net";
mail("$formatted_number", "TestingText", "$message");
echo"Success";
}

else if ($carrier == "virgin") {
$formatted_number = $to."@vmobl.com";
mail("$formatted_number", "TestingText", "$message");

echo"Success";
}
?>

If anyone has any idea of cloaking the hosting servers name. Let me know please.
Thanks all.

Try using the ‘from’ parameter in the mail function.
http://www.php.net/manual/en/function.mail.php