需要有关使用 java 发送短信的帮助

发布于 2024-12-17 18:07:09 字数 1484 浏览 0 评论 0原文

我想使用我的 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:

[email protected]

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

Bonjour°[大白 2024-12-24 18:07:09

错误消息准确地向您显示了问题所在:

DNS Error: Domain name not found

没有 sms.smtp.google.com 的 DNS 条目。和你的设置没有任何关系。 Google 不提供公共短信网关(发送短信通常需要付费)。

例如,您可以尝试 Amazon Simple Notification Service

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.

书信已泛黄 2024-12-24 18:07:09

可以使用电子邮件通过 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].

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文