'Function to send SMS via SMTP
NB Different Gateways have different requirements for presence/absence of International code
http://en.wikipedia.org/wiki/List_of_SMS_gateways
http://www.obviously.com/tech_tips/SMS_Text_Email_Gateway.html'

def send_sms_via_smtp(self, mobile, text='', channel_id=None):

    table = current.s3db.msg_sms_smtp_channel
    if channel_id:
        query = (table.channel_id == channel_id)
    else:
        query = (table.enabled == True)
    settings = current.db(query).select(limitby=(0, 1)).first()
    if (not settings):
        return False
    mobile = self.sanitise_phone(mobile, channel_id)
    to = ('%s@%s' % (mobile, settings.address))
    try:
        result = self.send_email(to=to, subject='', message=text)
        return result
    except:
        return False
