I want to send SMS using my java program. The scenario is that i have a server on which management program(written In java) is running. User can post their problems on the server. I want that when someone post their problem on server my java program generate an SMS to the user mobile number that your problem has been submitted. I searched Google and found that you can use Java Mail API to send sms to user. I tried the program given on this link
i used these parameters
......
public void msgSend() {
String gmailUserName = "xxxx@gmail.com";
String gmailPassword = "xxxx";
String smtpHost = "smtp.gmail.com";
String compression = "My Sms Compression information";
String from = "Basit@smtp.gmail.com";
String to = "03072525725@sms.smtp.gmail.com";
String body = "Hi how r u";
Transport myTransport = null;
...
...
After using this i received an email on my Gmail account with the following error
Delivery to the following recipient failed permanently:
03072525725@sms.smtp.gmail.com
Technical details of permanent failure: DNS Error: Domain name not found
I think that perhaps i didn't configure my Gmail account for mobile that's why i got this error. But i want to ask is it possible that i send sms using Java Mail API?
The error message shows you exactly the problem:
There is no DNS entry for
sms.smtp.google.com
. It doesn't have anything to do with your settings. Google does not offer a public SMS gateway (sending SMS normally costs money).You could try Amazon Simple Notification Service, for example.
It is possible to use email to send messages via SMS using an SMS gateway. It does require you to know the recipient phone number's carrier however.
For example:
Using the chart in the Wikipedia article in the link above, if the phone number is 7675431234 and the carrier is AT&T, then the email address to use would be
7675431234@txt.att.net
.