需要使用java发送短信的帮助 [英] Need help regarding sending SMS using java

查看:159
本文介绍了需要使用java发送短信的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用我的java程序发送短信。这种情况是我有一个服务器,管理程序(在java中编写)正在运行。用户可以在服务器上发布问题。我想要的是,当有人在服务器上发布问题时,我的Java程序会为您的问题提交的用户手机号码生成一条短信。
我搜索Google,发现您可以使用Java Mail API向用户发送短信。我尝试了这个链接给出的程序



我使用这些参数

  ...... 

public void msgSend(){

String gmailUserName =xxxx@gmail.com;
String gmailPassword =xxxx;
String smtpHost =smtp.gmail.com;
String compression =我的Sms压缩信息;
String from =Basit@smtp.gmail.com;
String to =03072525725@sms.smtp.gmail.com;
String body =Hi how r u;
传输myTransport = null;
...
...

使用完后,我收到了一封电子邮件在我的Gmail帐户上,
以下错误


递送到以下收件人永久失败:



03072525725@sms.smtp.gmail.com



永久性失败的技术细节:DNS错误:域名不是
found < X-4545454545 X- 20045 X- 200 X- 200 200 X- 200 200 X- 200 200 X- 200 200 X- 1992:但是我想问的是,我可以使用Java Mail API发送短信吗?

解决方案

错误信息显示了您的问题:

 
DNS错误:未找到域名

sms.smtp.google.com 没有DNS条目。它与您的设置无关。 Google不提供公共短信网关(通常发送短信费用)。



您可以尝试 Amazon Simple Notification Service


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:

DNS Error: Domain name not found

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.

这篇关于需要使用java发送短信的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆