飞信发送短信

简介:
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. }  
相关文章
|
Android开发 开发工具 数据格式
|
存储 .NET
利用短信猫发送短信
using System;using System.Collections.Generic;using System.
1102 0
|
运维 JavaScript Java
nodejs实现腾讯云短信发送提醒
在我们做运维或者小工具的时候,总会有些需要提醒的事情,比如服务器宕机或者天气提醒,但是发email又会不够及时或者可能会忽略,那么短信就是一个不错的选择了
nodejs实现腾讯云短信发送提醒
|
Java 云计算
JAVA实现《阿里云发送短信验证码以及短信通知》
JAVA实现《阿里云发送短信验证码以及短信通知》
983 0
|
Prometheus 运维 监控
三分钟实现Prometheus电话短信邮件钉钉飞书企业微信报警
Spug推送助手针对Prometheus内置好了报警模板,可以通过简单的配置就可以实现Prometheus电话、短信、邮件、钉钉、飞书、企业微信等报警。
1721 0

热门文章

最新文章