Hi;
I can't find any recent posts about this problem...
I am trying to write a script that will send a text message to a cel phone (I've been using Verion's (phonenumber@vtext.com) system. I've got the basics of it working okay, but have not figured out how to get the "From:" (or Fr to work properly (it always fills in with my server's default sendmail_from value of "me@localhost.com").
Here are the basics of the functional script.
<?
foreach ($_POST as $var=>$value) {
$$var="$value"; //echo "$var: $value<br>";
}
$messagestring="\r\n$Name\r\nPh:$Phone\r\nContactEmail:$ContactEmail\r\nRE: $Listing $Message";
// Set the variables for the database access:
///First put the info into a table to facilitate recordkeeping
$Host = "localhost";
$User = "nevermind";
$Password = "wouldntyouliketoknow";
$DBName = "databasename";
$Link = mysql_connect ($Host, $User, $Password);
mysql_select_db($DBName);
$new_inquiry = "INSERT INTO inquiries (inq_id, Name, Phone, ContactEmail, CCRE_ID, Message, submitted) VALUES ('','$Name','$Phone','$ContactEmail','$CCRE_ID','$Message', NOW())";
$Resultnew_inquiry= mysql_query($new_inquiry, $Link);
//send to staff member's regular email too..
$success2 =mail($EMAIL,'CCRE_site',$messagestring,'FROM:$ContactEmail');
//send as a text message to staff member's cel phone
// ******** PROBLEM: THE headers section does not work...'FROM:$ContactEmail' ...only "me@localhost.com" appears in message ********
$success =mail($VTEXT,'CCRE_site',$messagestring,'FROM:$ContactEmail');
//kludge/workaround: Included $ContactEmail in $messagestring
if($success)
{
//<!--close window without Javascript-->
echo "<br>Your message was sent. Thank you.<p align=\"left\"><input type=\"button\" value=\"Close this window\" onclick=\"self.close()\"></p>";
exit;}
else
{
echo "<br>There was a problem sending your message. <br>Please try again later. Thank you.<p align=\"left\"><input type=\"button\" value=\"Close this window\" onclick=\"self.close()\"></p>";
exit;}
?>
(BTW my pages are on a Windows server and the provider refuses to upgrade from php v4.1.2)