Sending SMS (Text) Messages (Python)

Following on from my Pollen Count project I wondered if it would be possible to send the same information via SMS (Short Message Service / text message) to a mobile phone. Being a test idea I didn’t want to pay for sending test SMS messages and didn’t want to sign my mobile number up to a 3rd party (I get enough spam calls as it is). So I started looking at the idea from another way.

Mobile phone providers have a SMS gateway, which is most cases can transfer an email to SMS and deliver it to a mobile phone. Wikipedia has the details at , however there are no UK mobile providers listed. Some Googling shows that Vodafone and O2 don’t offer the service, and after checking with Three (via Twitter) they too don’t offer the service. The Guardian reported in 2013 that T-Mobile might still offer the service – .

If it was available, how would it work?

Believe it or not, its just as simple as replacing an e-mail address with mobile_number@phone_provider_domain e.g. So in my previous project I would replace the “To” email address with a mobile phone number:

#smtp aka email settings
smtpObj = smtplib.SMTP_SSL(smtp_server, port)
smtpObj.login(login_user, login_pass)

msg_pollen = ‘Pollen Level at ‘ + current_time_edited + ‘ is ‘ + pollen_level_edited + ‘. This data was checked ‘ + time_edited
msg_pollen = str(msg_pollen)

smtpObj.sendmail(from_address, ‘’,
‘From:’from_address’\nSubject: Pollen\n\n’ + msg_pollen)

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.