<p>What is the best way to programmatically send an SMS text message?</p>

<p>Are there any free Web Service based SMS gateways?</p>

<p>I know that if I happen to know the user's carrier (Sprint, AT&amp;T, etc), I can send an <a href="http://en.wikipedia.org/wiki/SMS_gateways" rel="noreferrer">SMS by emailing an address</a> based on phone number + carrier. I would like a good solution that does not require me to know the carrier. Barring that, is there an easy way to lookup carrier given a cell phone number?</p>

<p>I understand that there are some services independent of the major mobile carriers that offer a per-message fee-based service, with API. What I would like to know is how such organizations tap into the SMS networks. Do they have contracts with mobile carriers to resell their services?</p>

[{'answer_id': 4284, 'author': 'Grant', 'author_id': 30, 'author_profile': 'https://Stackoverflow.com/users/30', 'pm_score': 1, 'selected': False, 'text': '<p>I don\'t know of any free SMS services, you usually buy bulk sms\'seses and use an API to send them out. </p>\n\n<p><a href="http://developer.whitepages.com/docs/" rel="nofollow noreferrer">Whitepages.com</a> has an API that will allow developers to reverse lookup a phone number. It reports the carrier on mobile number, however a lot of the time it\'s some non-existent-anymore carrier like Powertel or something.</p>\n'}, {'answer_id': 4285, 'author': 'Angus', 'author_id': 552, 'author_profile': 'https://Stackoverflow.com/users/552', 'pm_score': 3, 'selected': False, 'text': '<p>Where I work we\'ve been using <a href="http://www.clickatell.com" rel="noreferrer">http://www.clickatell.com</a> for sending out SMS - it looks like its about 6 or 7 cents a message.  They just take http POST requests to send out a message.  I don\'t know if you\'ll be able to find any good free gateways.  We used to send out emails, but found they were unreliable.</p>\n'}, {'answer_id': 4289, 'author': 'Jeremy Privett', 'author_id': 560, 'author_profile': 'https://Stackoverflow.com/users/560', 'pm_score': 0, 'selected': False, 'text': '<p>Supporting <a href="https://stackoverflow.com/questions/4269/programmatic-sms#4285">Angus</a>, I can vouch for <a href="http://www.clickatell.com" rel="nofollow noreferrer">http://www.clickatell.com</a>. It was used at a company I used to work at. It was a very easy solution to setup and use and worked great. You just need to anticipate how many messages you intend to send out and bulk order messages. They\'re pretty cheap, overall.</p>\n'}, {'answer_id': 22209, 'author': 'Matt Lacey', 'author_id': 1755, 'author_profile': 'https://Stackoverflow.com/users/1755', 'pm_score': 3, 'selected': False, 'text': "<p>I've used clickatell in the past and found them very good also.</p>\n\n<p>However, You could build your own to get messages VERY cheap. All you need is: a contract which gives loads of (or unlimited) messages; windows mobile phone; and a bit of socket programming.</p>\n\n<p>Write a web service (pass the number and the message) which makes a call to a program on the mobile which sends the message.</p>\n\n<p>I know of at least FTSE100 company which went this route.</p>\n"}, {'answer_id': 22217, 'author': 'Michał Piaskowski', 'author_id': 1534, 'author_profile': 'https://Stackoverflow.com/users/1534', 'pm_score': 2, 'selected': False, 'text': '<p>I have been doing that with a nokia phone, connected to a linux machine. I have a cron job and a script that would check a database table for new messages and use <a href="http://www.gnokii.org/" rel="nofollow noreferrer">gnokii</a> to send messages. It works great if the number of sms you are goig to send isn\'t to big.</p>\n'}, {'answer_id': 429566, 'author': 'masfenix', 'author_id': 50312, 'author_profile': 'https://Stackoverflow.com/users/50312', 'pm_score': -1, 'selected': False, 'text': '<p>Sorry, after re-reading your question i realized this is not the answer your looking for. However this is what i did for my command line program. There\'s a website where if you put in the telephone number it gives you the carrier. So when i entered my number it screen scraped the website, got the carrier and if the carrier is in my list, i retrieved the email of that carrier</p>\n\n<p>Most companies offer a SMS-to-email kinda thing. For example <code>myphonenumber@verizon.com</code> or something (there\'s a whole list on wikipedia).</p>\n\n<p>I used that to create my self a little command line application in c# that sends out text messages. However, you don\'t really get a "reply" and the number is a pre-assigned one from the company. </p>\n\n<p>I think if you want to go the free route, this is your best bet.</p>\n\n<p>Here\'s the wikipedia link:\n<a href="http://en.wikipedia.org/wiki/SMS_gateways" rel="nofollow noreferrer">SMS gateway</a></p>\n'}, {'answer_id': 429573, 'author': 'Eldelshell', 'author_id': 48869, 'author_profile': 'https://Stackoverflow.com/users/48869', 'pm_score': 2, 'selected': False, 'text': "<p>You could also get a GSM transmitter and issue AT commands that send sms's. Don't know why you would want to do it this way, but it's another option. This way you won't depend on someone else service</p>\n"}, {'answer_id': 1014471, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 3, 'selected': False, 'text': "<p>We got fed up with using 'free' sms gateways, very unreliable.</p>\n\n<p>Now we use an sms gateway device called OutboxSMS from Felltech Ltd. It sits on our network and hooks directly into out mobile phone provider using a wireless link from it's built-in transmitter. We needed to buy a SIM card (we got a PAYG with a huge bundle of messages), which is fitted to the OutboxSMS unit. We configured an email account for it on our mail server (MS Exchange), and configured the SMTP/POP3 account on the box.</p>\n\n<p>We use OPManager, this sends alerts by email, which we direct to outboxsms, it parses the message and sends a text message to our ops guys phones when something goes wrong. </p>\n\n<p>We also have some shell scripts which use sendmail to send an email to outboxsms, which again is converted to text messages. </p>\n"}, {'answer_id': 4763544, 'author': 'Christian Joudrey', 'author_id': 504733, 'author_profile': 'https://Stackoverflow.com/users/504733', 'pm_score': 5, 'selected': False, 'text': '<p>Use <a href="http://www.twilio.com/" rel="noreferrer">http://www.twilio.com/</a></p>\n\n<p>They have a REST interface to send SMS\'s and even to establish phone calls or receive phone calls.</p>\n\n<p>You even get 30$ credits to try it out.</p>\n\n<p>Def. the cheapest solution you will find.</p>\n'}, {'answer_id': 7202139, 'author': 'Jannie Theunissen', 'author_id': 96944, 'author_profile': 'https://Stackoverflow.com/users/96944', 'pm_score': 0, 'selected': False, 'text': '<p>I have used <a href="http://www.textmagic.com/" rel="nofollow">TextMagic</a>. They have reasonable rates and a great API and account management.</p>\n'}, {'answer_id': 15582997, 'author': 'Telmo Dias', 'author_id': 588003, 'author_profile': 'https://Stackoverflow.com/users/588003', 'pm_score': 2, 'selected': False, 'text': '<p>I think this one deserves a new answer. There\'s a new player in town, it\'s called Nexmo and features highly competitive prices, even compared to Twilio.</p>\n\n<p><a href="https://www.nexmo.com/" rel="nofollow noreferrer">https://www.nexmo.com/</a></p>\n'}]
['https://Stackoverflow.com/questions/4269', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/357/']