Self-written free text messaging software [Apsara API]

Source: Internet
Author: User

I saw a post on csdn at noon today, saying that there was an API that could use Java to send Apsara mail. I tested it myself,

I personally tested it and was able to send it successfully!

If it feels fresh, let us know how to play:

[Skip this step and go straight to the code !]

1. Go to the http://download.csdn.net/source/1148854 to download a jar package.

2. Open the eclipse new project testfetion, click Next, click the libraries tab, click "add external jars", select the downloaded fetion. jar file, and click Finish.

3. Create a new package and create another class testfetion.

Enter the following code:

Package fetion; // fetion is the common package name in step 3. <br/> Import Java. io. ioexception; <br/> Import cn.edu. ctgu. ghl. fetion. contact; <br/> Import cn.edu. ctgu. ghl. fetion. fetion; <br/> Import cn.edu. ctgu. ghl. fetion. fetionevent; <br/> Import cn.edu. ctgu. ghl. fetion. ifetioneventlistener; <br/> public class testfetion {<br/> Public static void main (string [] ARGs) throws exception {<br/> final fetion = new fetion ("1589 ** * ***** "," 123456 "); // here, 1589 ***** is your mobile phone number and 123456 is your Feixin password <br/> fetion. addlistener (New ifetioneventlistener () {<br/> Public void process (fetionevent e) {<br/> If (E. getfirstline ()! = NULL & E. getfirstline (). startswith ("M") & E. getbody ()! = NULL) {<br/> fetion. sendsms2selfphone (E. tostring (); <br/> If (E. getbody (). trim (). startswith ("cmd") {<br/> system. out. println ("excute [" + E. getbody (). trim (). substring (3) + "]"); <br/> try {<br/> runtime.getruntime(.exe C (E. getbody (). trim (). substring (3); <br/>} catch (ioexception E1) {<br/> // todo auto-generated Catch Block <br/> e1.printstacktrace (); <br/>}< br/> }); <Br/> fetion. login (); <br/> // send a message to all friends. <br/> // For (contact CC: fetion. getcontacts () {<br/> // system. out. println ("####/R/N" + CC + "/R/N"); <br/> // fetion. sendsms (CC. geturi (), CC. getnickname () + "123... "); <br/>/}< br/> system. out. println ("Login successful! "); <Br/> fetion. sendsms2selfphone (" test! "); // The message is sent to yourself <br/> system. Out. println (" sent successfully! "); <Br/> fetion. logout (); <br/> system. Out. println (" quit! "); <Br/>}< br/>} 

This is just a command line mode. You can write a GUI. If you have any findings or do not understand it, you can reply!

/* <Br/> The following is a simple GUI text message sending program written by AWT. You can save time. <Br/> */<br/> package fetion; <br/> Import Java. applet. applet; <br/> Import Java. AWT. button; <br/> Import Java. AWT. label; <br/> Import Java. AWT. textarea; <br/> Import Java. AWT. textfield; <br/> Import Java. AWT. event. actionevent; <br/> Import Java. AWT. event. actionlistener; <br/> Import javax. swing. joptionpane; <br/> // Feixin interface class <br/> Import Java. io. ioexception; <br/> Import cn.edu. ctgu. ghl. fetion. contact; <br/> imp ORT cn.edu. ctgu. ghl. fetion. fetion; <br/> Import cn.edu. ctgu. ghl. fetion. fetionevent; <br/> Import cn.edu. ctgu. ghl. fetion. ifetioneventlistener; <br/> public class fetiongui extends applet implements actionlistener {<br/>/** <br/> */<br/> Private Static final long serialversionuid = 1l; <br/> private textfield txtphonenum; <br/> private textfield txtpassword; <br/> private textarea txtmessage; <br/> Private textfield txtreceiver; <br/> private label lblnum; <br/> private label lblpass; <br/> private label lblmessage; <br/> private label lblreceiver; <br/> private button btnlogin; <br/> private button btnexit; <br/> private button btnsend; <br/> private fetion; <br/> @ override <br/> Public void Init () {<br/> // todo auto-generated method stub <br/> super. init (); <br/> txtphonenum = new textfield ("", 11); <br/> txtpassword = new textfield ("", 11); <br/> lblnum = new label ("mobile phone number "); <br/> lblpass = new label ("Feixin password"); <br/> lblreceiver = new label ("recipient "); <br/> txtreceiver = new textfield ("", 11); <br/> lblmessage = new label ("info "); <br/> txtmessage = new textarea ("", 10, 15); <br/> btnlogin = new button ("login "); <br/> btnsend = new button ("send"); <br/> btnexit = new button ("quit"); <br/> This. add (lblnum); <br/> This. ad D (txtphonenum); <br/> This. add (lblpass); <br/> This. add (txtpassword); <br/> txtpassword. setechochar ('*'); <br/> This. add (lblreceiver); <br/> This. add (txtreceiver); <br/> This. add (lblmessage); <br/> This. add (txtmessage); <br/> This. add (btnlogin); <br/> This. add (btnsend); <br/> This. add (btnexit); <br/> btnlogin. addactionlistener (this); <br/> btnsend. addactionlistener (this); <br/> btnexit. addactionli Stener (this); <br/>/**/<br/> // send a message to all friends. <br/> // For (contact CC: fetion. getcontacts () {<br/> // system. out. println ("####/R/N" + CC + "/R/N"); <br/> // fetion. sendsms (CC. geturi (), CC. getnickname () + "123... "); <br/>/}< br/> joptionpane. showmessagedialog (null, "preparations complete! "); <Br/> // fetion. login (); <br/> // For (contact CC: fetion. getcontacts () {<br/> // system. out. println ("####/R/N" + CC. getphonenum () + "/R/N"); <br/> /// fetion. sendsms (CC. geturi (), CC. getnickname () + "123... "); <br/>//} <br/> // fetion. logout (); <br/>}< br/> @ override <br/> Public void actionreceivmed (actionevent e) {<br/> If (E. getsource () = btnlogin) {<br/> fetion = new fetion (txtphonenum. gettext (). Trim (), txtpassword. gettext (). trim (); <br/> fetion. addlistener (New ifetioneventlistener () {<br/> Public void process (fetionevent e) {<br/> If (E. getfirstline ()! = NULL & E. getfirstline (). startswith ("M") & E. getbody ()! = NULL) {<br/> fetion. sendsms2selfphone (E. tostring (); <br/> If (E. getbody (). trim (). startswith ("cmd") {<br/> system. out. println ("excute [" + E. getbody (). trim (). substring (3) + "]"); <br/> try {<br/> runtime.getruntime(.exe C (E. getbody (). trim (). substring (3); <br/>} catch (ioexception E1) {<br/> e1.printstacktrace (); <br/>}< br/>}); <br/> joptionpane. showmessagedialog (NUL L, "start logging on"); <br/> fetion. login (); <br/> // For (contact CC: fetion. getcontacts () {<br/> // system. out. println ("####/R/N" + CC. getphonenum () + CC. getnickname () + CC. getType () + "/R/N"); <br/> /// fetion. sendsms (CC. geturi (), CC. getnickname () + "123... "); <br/>/}< br/> joptionpane. showmessagedialog (null, "Login successful"); <br/>} else if (E. getsource () = btnexit) {<br/> // joptionpane. showmessagedialog (null, "Exit! "); <Br/> // fetion. logout (); <br/> system. Out. println (" exit! "); <Br/> system. exit (0); <br/>} else if (E. getsource () = btnsend) {<br/> // fetion. sendsms2selfphone (txtmessage. gettext (); // The message is sent to yourself. <br/> fetion. sendsms (txtreceiver. gettext (), txtmessage. gettext (); <br/> system. out. println ("sent successfully! "); <Br/>}< br/>} 

The same is true for many online fetion principles!

Disclaimer: this package is intended for personal testing on the Internet and has been tested on its own, but it does not guarantee its full security. Please feel free to use it, but I am not responsible for it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.