以前以为协议非常高神,但做了这个之后发现还好,没想象的那么艰难。
先要了解邮件的原理
再者就是上面2协议
可以先用telnet测试一下,以初步了解那2协议:http://hi.baidu.com/343243581/item/113c7212ced7e0e05e53b1d8
实现大致思想,SMTP,POP3相关介绍:http://www.doc88.com/p-929298657611.html
主要人家都讲得很好很详细了,天冷,我也懒得打字了。
/*这里面放一些公共的头文件*/ #include <stdio.h> #include <string.h> #include <sys/socket.h> #include <arpa/inet.h> //字节序转换函数 #include <netdb.h> //地址查询 extern int BUFFMAX; extern void recvCntInfo(int cnt,char thisBuff[]);
#include <stdio.h> /*下面定义常量*/ const int BUFFMAX=2000; //接受消息缓冲区大小 /*处理的函数*/ void recvCntInfo(int cnt,char thisBuff[]) { if(cnt==-1) { printf("recv出错,退出程序! "); exit(0); } else if(cnt==0) { printf("无可用消息或对方已经按序结束! "); } else { thisBuff[cnt]='