需要有关使用 java 发送短信的帮助
我想使用我的 java 程序发送短信。场景是我有一台服务器正在运行管理程序(用java编写)。用户可以在服务器上发布他们的问题。我希望当有人在服务器上发布他们的问题时,我的java程序会向用户手机号码生成一条短信,表明您的问题已提交。 我搜索了Google,发现可以使用Java Mail API向用户发送短信。我尝试了此 链接 上给出的程序
我使用了这些参数
......
public void msgSend() {
String gmailUserName = "[email protected]";
String gmailPassword = "xxxx";
String smtpHost = "smtp.gmail.com";
String compression = "My Sms Compression information";
String from = "[email protected]";
String to = "[email protected]";
String body = "Hi how r u";
Transport myTransport = null;
...
...
使用此后我的 Gmail 帐户收到一封电子邮件,内容为 跟随错误
向以下收件人的递送永久失败:
永久故障的技术细节:DNS 错误:域名不存在 找到了
我认为也许我没有为移动设备配置我的 Gmail 帐户,这就是我收到此错误的原因。但我想问我是否可以使用 Java Mail API 发送短信?
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 = "[email protected]";
String gmailPassword = "xxxx";
String smtpHost = "smtp.gmail.com";
String compression = "My Sms Compression information";
String from = "[email protected]";
String to = "[email protected]";
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:
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
错误消息准确地向您显示了问题所在:
没有
sms.smtp.google.com
的 DNS 条目。和你的设置没有任何关系。 Google 不提供公共短信网关(发送短信通常需要付费)。例如,您可以尝试 Amazon Simple Notification Service。
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.
可以使用电子邮件通过 SMS gateway。但是,它确实要求您知道收件人电话号码的运营商。
例如:
使用上面链接中维基百科文章中的图表,如果电话号码是 7675431234 并且运营商是 AT&T,则要使用的电子邮件地址将为
[电子邮件受保护]
。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
[email protected]
.