sendsimple.java
来自「控制手机发送短信程序」· Java 代码 · 共 40 行
JAVA
40 行
package mms;import java.io.File;import java.net.URL;import com.objectxp.mms.MMSAddress;import com.objectxp.mms.MMSService;import com.objectxp.mms.MMSServiceFactory;import com.objectxp.mms.message.MMSMessage;import com.objectxp.mms.message.SMILMessage;public class SendSimple{ public static void main(String[] args) throws Exception { // initialize Service MMSServiceFactory factory = MMSServiceFactory.createFactory(new File("/path/to/jsms.conf")); MMSService mmsService = factory.getDefaultService(); // load smilDocument from the given URL URL url = new URL("file:///path/to/your/smil.xml"); MMSMessage msg = new SMILMessage(url); msg.addTO(new MMSAddress(MMSAddress.TYPE_PLMN, "555123456")); // send Message try { mmsService.connect(); mmsService.send(msg); System.out.println("Message sent succesfully."); }catch (Exception e){ System.err.println("could not send Message:"+ e); e.printStackTrace(); } finally{ mmsService.disconnect(); } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?