okay, here is the code
while (!feof($text)) {
$name = fgets($text);
$number = fgets($text);
$carrier = fgets($text);
$date = fgets($text);
$line = fgets($text);
$content = $_POST['message'];
$message .= $content;
$message .= "\n";
$number = $number;
mail("$number@vtext.com", "Event Alert", $message, "SGA");
Header("Location: mailconf.php");
}
I am trying to get a message sent to a phone, I have ‘message’ coming in from a text area, and then I assign it to “$content” then I put “$content” into “$message” and then as you can see, in my mail line, I want the address to be the variable “number”@vtext.com I have the while loop because there are many people in these files I wish to send a message to…
When I change the “$number@vtext.com” to my email address, it sends everything fine, I just cannot seem to get it to send to a phone number, please help!
thanks!
The problem is that
fgetsincludes the newline character as part of the return. So you are effectively sending an email to:Which of course is invalid. Change your line that reads
$number = $numberto:And the rest of your code should function as expected, with the email being received on your phone.
Part of my original answer
I would highly recommend using a (probably paid) service to send SMS messages to phones if you need anything remotely reliable. A quick search yielded a few results: