SMS and SMTP
If you want to avoid the trouble of setting up your computer as an SMS gateway, you could send SMS messages using email. Many cell phone service providers let you send an SMS message to a cell phone via email, the text of which contains the SMS message to an email address with the following address format:
theCellPhoneNumber@theServiceProvider.com
For example, suppose I want to send an SMS message to a friend's cell phone. (For that matter, I could send it to his land line if the land line caller ID hardware is configured to display SMS, and my friend's telecom company supports the reception of email-to-SMS messages.) I write the following code that uses JavaMail:
public class SMSbyEMail { String msg; public SMSbyEMail(SMSNum) { //Set the message smsMsg = "Come to my party dude!" ; //Do some Java Mail configuration stuff boolean sessionDebug = false; Properties props = System.getProperties(); props.put("mail.host", "192.168.0.199"); props.put("mail.transport.protocol", "smtp"); Session mailSession = Session.getDefaultInstance(props, null); mailSession.setDebug(sessionDebug); try { //Configure the SMTP message Message msg = new MimeMessage(mailSession); msg.setFrom(new InternetAddress("party@dudes.com")); InternetAddress[] address = {new InternetAddress(SMSNum + "@hisCellCompany.net")}; msg.setRecipients(Message.RecipientType.TO, address); msg.setSubject(""); msg.setSentDate(new Date()); msg.setText(smsMsg); Transport.send(msg); } catch (Exception e) { System.out.println("No go: " + e); } } }