如何整合短信&我的 play2.0 框架 Web 应用程序中的 EMAIL 提醒. [英] how to integrate SMS & EMAIL Reminders in my play2.0 framework web application.

查看:18
本文介绍了如何整合短信&我的 play2.0 框架 Web 应用程序中的 EMAIL 提醒.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 play2.0 框架中创建一个 web 应用程序.在这个应用程序中,我需要集成 SMS 和 EMAIL 提醒,通过从数据库获取详细信息,在特定日期和时间发送短信和电子邮件.为此,是否有任何免费的 API 或调度程序或 Web 服务或应用程序?如果有的话,请告诉我如何使用?提前致谢.

I'm creating a web application in play2.0 framework.In this application i need to integrate SMS and EMAIL reminder to send sms and email on a particular date and time by getting the details from database. For that is there any Free API's or scheduler or web service or applications ? If there is any then kindly let me know how to use ? thanks in advance.

推荐答案

在 Play 1.x 中,这本可以通过 Jobs 的概念来实现.在 Play 2.x 中,代码的异步执行是使用 Akka 的调度程序完成的.

In Play 1.x, this would have been achieve with the concept of Jobs. In Play 2.x, asynchronous execution of code is done using Akka's scheduler.

因此,从您的用例来看,您可能希望有一个每隔几分钟运行一次的作业(例如假设为 30),然后转到数据库并检查是否需要发送任何电子邮件.从这里,您可以调用您的网络服务来发送短信和电子邮件.

So, from your use case, you will probably want to have a job that runs every few minutes (lets assume 30 for the example), that goes off to the database and checks to see if any emails need to be sent. From here, you can then call your web service to send SMS and Email.

Akka.system().scheduler().scheduleOnce(
  Duration.create(30, TimeUnit.MINUTES),
  new Runnable() {
    public void run() {
      // check database for reminders that need to be sent
      // send email
      // send SMS
    }
  }
); 

至于发送短信的服务,您可以查看 Twilio ( http://www.twilio.com/api/短信).您只需要使用 play.libs.WS 类进行集成.

As for services for sending SMS, you could check out Twilio ( http://www.twilio.com/api/sms ). You just need to integrate using the play.libs.WS class.

电子邮件是谜题中的一个微不足道的部分,已经被多次回复,所以我不会详细说明.

Email is a trivial part of the puzzle, and has been answered many times over already, so I won't go into detail on that.

这篇关于如何整合短信&我的 play2.0 框架 Web 应用程序中的 EMAIL 提醒.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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