I have been working a a program to send text messages using php but my headers containing the "From:" part of the text message keep on returning an error. Could someone please explain what i'm doing wrong. I have attached the php script and the html page I am using as a form.
<?php
$from = $_POST['from'];
$to = $_POST['to'];
$carrier = $_POST['carrier'];
$carrierFrom = $_POST['carrierFrom']
$message = stripslashes($_POST['message']);
//From Function
if ($carrierFrom == "verizon")
{$formatted_from = $from."@vtext.com";}
if ($carrierFrom == "tmobile")
{$formatted_from = $from."@tomomail.net";}
if ($carrierFrom == "sprint")
{$formatted_from = $from."@messaging.sprintpcs.com";}
if ($carrierFrom == "att") {
$formatted_from = $from."@txt.att.net";
if ($carrierFrom == "gmail") {
$formatted_from = $from."@gmail.com";
}
//To Function
if ($carrierFrom == "verizon")
{$formatted_number = $to."@vtext.com";}
if ($carrier == "tmobile")
{$formatted_number = $to."@tomomail.net";}
if ($carrier == "sprint")
{$formatted_number = $to."@messaging.sprintpcs.com";}
if ($carrier == "att")
{$formatted_number = $to."@txt.att.net";}
if ($carrier == "gmail")
{$formatted_number = $to."@gmail.com";}
//Send
$sent = mail($formatted_number,$message,$formattedFrom) ;
if($sent)
{print "Your text was sent successfully"; }
else
{print "We encountered an error sending your text"; }
?>
[attachment deleted by admin]