Posted by & filed under My Scripts, Other Computery Things, PHP.

closeThis post was originally published on the old blog. It is likely that the links and counters are dead. Should you require some code please email me at and I will see if I can help you out!

If you’ve been trying to get this to work you’ve undoubtedly found it’s a right pain in the ascii, however it CAN be done in a workaround way. This is the method I’ve used to get this to work. You should note that I have only tested this on my own mobile which is on a contract plan, not PAYT. I cannot guarantee this works on PAYT plans.

Firstly, make sure you have a vodafone.net account and if you don’t, use the links to get one. You should be supplied with an email address of “yourmobilenumber@vodafone.net“.
Login to this account and go to the “Settings” menu, then select “Message Notifications
Put a tick in the “A chargeable text message that contains the date, sender’s email address and message subject.” box and click “save“.

That’s the vodafone part set up, to check it put your phone number in this form (password: vodafone) and hit enter.

Next you need to set up your web form. On my own form visible here (if my linux computer is online) I have added a captcha and some error checking, however for the purposes of getting it working I’ll just show how to do a basic form and give the PHP code to make it work.

The Form
<form name="my_form" method="post" action="/sendtext.php" >
Your Email or Mobile #: <input name="email" type="text" /><br />
<textarea name="message" rows="10" cols="40">Your message here</textarea><br />
<input name="Submit" type="submit" value="Submit" />
</form>

Put the following code into a file and call it “sendtext.php” (don’t forget to change YOURNUMBER to your own mobile number)

The PHP Code
<?php
$email = $_POST['email'] ;
$message = $_POST['message'] ;
if (is_numeric($email)) { mail('YOURNUMBER@vodafone.net', $message, $message, "From:$email@txt"); }
else mail('YOURNUMBER@vodafone.net', $message, $message, "From:$email");
echo "Your text message has been sent to my mobile! Cool eh?<br />";
echo '<a href="javascript:history.go(-1)">back</a> ';
?>

The reason you see the message and not just the subject is that the subject IS the message and vice-versa, getting round the problem of having to log-in to your vodafone email account to read the messages. This also has the advantage of keeping your mobile number hidden from view in the php file(which is never sent to the browser) so people can message you without letting them know your number.

The entire form works as such..

Your Email or Mobile #:

Leave a Reply

  • (will not be published)