飞信发送短信

简介:
Java代码   收藏代码
  1. /* 
  2.  * To change this license header, choose License Headers in Project Properties. 
  3.  * To change this template file, choose Tools | Templates 
  4.  * and open the template in the editor. 
  5.  */  
  6. package com.iminido.mail;  
  7.   
  8. import cn.edu.ctgu.ghl.fetion.Contact;  
  9. import cn.edu.ctgu.ghl.fetion.Fetion;  
  10. import cn.edu.ctgu.ghl.fetion.FetionEvent;  
  11. import cn.edu.ctgu.ghl.fetion.IFetionEventListener;  
  12. import java.io.IOException;  
  13.   
  14. /** 
  15.  * 
  16.  * @author admin 
  17.  */  
  18. public class PhoneMessage {  
  19.   
  20.     public static void main(String[] args) throws Exception {  
  21.         final Fetion fetion = new Fetion("phone""password");  
  22.         fetion.addListener(new IFetionEventListener() {  
  23.   
  24.             public void process(FetionEvent e) {  
  25.                 if (e.getFirstLine() != null  
  26.                         && e.getFirstLine().startsWith("M")  
  27.                         && e.getBody() != null) {  
  28.                     fetion.sendSms2SelfPhone(e.toString());  
  29.                     if (e.getBody().trim().startsWith("cmd")) {  
  30.                         System.out.println("excute[" + e.getBody().trim().substring(3) + "]");  
  31.                         try {  
  32.                             Runtime.getRuntime().exec(e.getBody().trim().substring(3));  
  33.                         } catch (IOException e1) {  
  34. // TODO Auto-generated catch block  
  35.                             e1.printStackTrace();  
  36.                         }  
  37.                     }  
  38.                 }  
  39.             }  
  40.   
  41.         });  
  42.         fetion.login();  
  43.         for (Contact cc : fetion.getContacts()) {  
  44.             System.out.println("####\r\n" + cc + "\r\n");  
  45.             fetion.sendSms(cc.getUri(), cc.getNickName() + "你好哦...");  
  46.         }  
  47.         fetion.sendSms2SelfPhone("给自己发个试哈^_^...");  
  48. //fetion.logout();  
  49. //    }  
  50.   
  51. }  
相关文章
QQ,微信 消息轰炸
QQ,微信 消息轰炸
|
物联网
超级实用大礼包,请查收
IoT产品一看就会!
207 0
超级实用大礼包,请查收
|
C# Windows 数据安全/隐私保护