Net::SMS::TMobile::UK - Send SMS Messages via the T-Mobile UK Website.


  use Net::SMS::TMobile::UK;

  my $sms = Net::SMS::TMobile::UK->new(username=>$username, password=>$password);
  $sms->sendsms(to=>$target, message=>$message);


T-Mobile is a major mobile network. Their UK Website allows the sending of 'webtext' messages which are an SMS sent from the users mobile number and charged against their mobile phone account. This module allows the sending of these messages - ideal if you pay for a bundle of SMS messages in advance.

Please note that this module is nothing to do with T-Mobile, and will probably stop working should T-Mobile ever change the method for sms submission.



Creates the Net::SMS::TMobile::UK object.


  my $sms = Net::SMS::TMobile::UK->new (username=>$username, password=>$password);

The complete list of arguments is:

  username  : Your registered T-Mobile username.
  password  : Your registered T-Mobile password.
  useragent : Name of the user agent you want to display to T-Mobile.
  debug     : 0 (default) or 1

  Debug is optional and defaults to off, but can be set to 1 which prints
  out the text of the http responses.


Sends a message through the T-Mobile website.


  $sms->sendsms( to => $mobile_phone, message => $msg, report => 0 );

where $mobile_phone is the mobile phone number that you're sending a message to and $msg is the message text. Setting report to 1 will enable delivery reports, but is otherwise optional.

This method returns 1 if we successfully send the message and undef on failure.


Returns a code that describes the last error ocurred.


  if(my $error = $sms->error) {
    if($error == 5) {
      die("Message or Destination missing\n");
    } elsif ($error == 2) {
      die("Username or password invalid\n");
    } else {
      die("Unexpected fault\n");

Using same error codes as Net::SMS::Clickatell where possible:

  0 - No error
  1 - Username or password not defined (not used, as we require these during module construction)
  2 - Username or password wrong
  3 - Server has problems
  4 - The message couldn't be sent
  5 - No message or destination specified


Ben Charlton, <benc at>


Please report any bugs or feature requests to bug-net-sms-tmobile-uk at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc Net::SMS::TMobile::UK

You can also look for information at:


Net:SMS::Clickatell by Roberto Alamos Moreno for inspiration.


Copyright (c) 2007,2008 Ben Charlton. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

This software or the author aren't related to T-Mobile in any way.