金笛邮件系统短信接口文档
jdmail短信接口开发方法
1)概述
系统所有发送短信功能通过调用实现接口:jdmail.mobile.sms. SendSMSInterface 的send 方法进行短信发送。
jdmail.mobile.sms. SendSMSInterface接口代码结构如下:
package jdmail.mobile.sms;
public interface SendSMSInterface {
public int send(String Phone, String Content);
}
其中:
Phone ―― 接收人手机号码
Content―― 短信文本内容
短信接口实现类例子:
package jdmail.mobile.sms;
public class TestSendSMS implements SendSMSInterface{
public int send(String sPhone, String strContent){
System.out.println("send sms mobile:" + sPhone + " content:" + strContent);
return 0;
}
}
系统内置默认实现的短信发送类:jdmail.mobile.sms.SendSMS ,是通过标准的短信猫进行发送短信。
2)开发步骤
①.编写实现接口jdmail.mobile.sms. SendSMS Interface 的类,在结构方法send 中加入自己发送短信的代码。如:TestSendSMS
②.把实现类打包成.jar 文件和相关的依赖库放在 web/webapps/ROOT/WEB-INF/lib 目录下。
③.在系统设置 → 短信设置的“SMS 发送实现类”项写入类的全名。
④.重启webmail 服务器
3)测试方法
在短信测试部分,输入测试接收手机号码和短信文本内容,点击发送测试,进行测试。
|