`
t225com
  • 浏览: 660839 次
文章分类
社区版块
存档分类
最新评论

EML提取主题信息

 
阅读更多

从邮件EML类型的文件中提取邮件主题信息,保存进文本TXT。可以用来做一些基于邮件系统的远程控制。

Code:
  1. /**********************************************
  2. *从EML邮件文件中提取主题信息
  3. *
  4. *徐方鑫280599580@qq.com
  5. *
  6. ***********************************************/
  7. #include<stdio.h>
  8. #include<string.h>
  9. #include<stdlib.h>
  10. voiddelay(longcnt)
  11. {
  12. while(--cnt);
  13. }
  14. intmain()
  15. {
  16. FILE*fp;
  17. inti,j;
  18. charstr[200];/*接收从文件中读出字符的数组*/
  19. charsubject[200];
  20. system("ren*.eml1.txt");
  21. if((fp=fopen("1.txt","r+"))==NULL)
  22. {
  23. printf("Filecannotbeopened/n");
  24. exit(0);
  25. }
  26. else
  27. {
  28. //printf("Fileopenedforwriting/n");
  29. //system("pause");
  30. while(1)
  31. {
  32. fgets(str,100,fp);/*读字符串到str[]中*/
  33. //puts(str);
  34. if(str[0]==83)
  35. if(str[1]==117)
  36. if(str[2]==98)
  37. if(str[3]==106)
  38. if(str[4]==101)
  39. if(str[5]==99)
  40. if(str[6]==116)
  41. break;//获取目标SUBJECT
  42. //delay(200000000);
  43. //puts(str);
  44. }
  45. //printf("ok/n%d/n",strlen(str));
  46. for(i=9,j=0;str[i]!=EOF;i++,j++)//I是修改subject第几位开始提取数据
  47. subject[j]=str[i];//另存目标数组
  48. fclose(fp);
  49. fopen("subject.txt","w");
  50. fputs(subject,fp);
  51. //puts(subject);
  52. //printf("%d/n",strlen(subject));
  53. }
  54. system("ren1.txt*.eml");
  55. system("del*.eml");
  56. //system("pause");
  57. return0;
  58. }

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics