I'm really lost now at this part where I need to send sms to multiple recipients.
How do i send an sms to all the contacts i have in my database? Do I use for-loops? Or is there other ways? Please help thank you so much.
This is my SMS code
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import serial
import time
import sys
import MySQLdb as mdb
try:
con = mdb.connect('localhost', 'user', 'password', 'db')
print 'Database connected';
except Exception as e:
sys.exit('Database connection failed')
cur = con.cursor()
cur.execute("Select contacts from dbtable")
con.commit()
number= cur.fetchall()
print number
for item in number:
recipient= recipient+item