开启辅助访问 切换到宽版

精易论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

用微信号发送消息登录论坛

新人指南 邀请好友注册 - 我关注人的新帖 教你赚取精币 - 每日签到


求职/招聘- 论坛接单- 开发者大厅

论坛版规 总版规 - 建议/投诉 - 应聘版主 - 精华帖总集 积分说明 - 禁言标准 - 有奖举报

查看: 6356|回复: 22
收起左侧

[易语言纯源码] 分享个c++编译dll,imap稳定取件方法

[复制链接]

结帖率:100% (9/9)
发表于 2021-8-28 20:08:37 | 显示全部楼层 |阅读模式   重庆市重庆市
分享源码
界面截图: -
是否带模块: 调用了模块
备注说明: -
需要ssl,imap取件,论坛找了下,好像没有稳定
就找了c++的编译成dll,配合易语言就完美调用了
依赖这个库:https://www.example-code.com/vcpp/imap_ssl.asp

附上简单修改的代码(取指定发件人发来的验证马,正则取出,失败返回-1,没有返回0,找到返回1)
  1. // dllmain.cpp : 定义 DLL 应用程序的入口点。

  2. #include "include/CkImap.h"
  3. #include "include/CkMessageSet.h"
  4. #include "include/CkEmailBundle.h"
  5. #include "include/CkEmail.h"
  6. #include <iostream>
  7. #include <regex>
  8. using namespace std;
  9. extern "C" __declspec(dllexport) int findMail(const char* pU, const char* pP, char* pOut) {
  10.     int ret = -1;
  11.     // This example assumes the Chilkat API to have been previously unlocked.
  12.     // See Global Unlock Sample for sample code.
  13.     CkImap imap;
  14.     // To use a secure TLS/SSL connection, set the Ssl property and the port:
  15.     imap.put_Ssl(true);
  16.     // The typical port for IMAP SSL is 993
  17.     imap.put_Port(993);
  18.     // Connect to an IMAP server.
  19.     if (imap.Connect("imap-mail.outlook.com")) {
  20.         if (imap.Login(pU, pP)) {
  21.             if (imap.SelectMailbox("Inbox")) {
  22.                 bool fetchUids = true;
  23.                 // Get the message IDs of all the emails in the mailbox
  24.                 CkMessageSet* messageSet = imap.Search("FROM 【【【这里改成发件人】】】", fetchUids);
  25.                 if (imap.get_LastMethodSuccess()) {
  26.                     CkEmailBundle* bundle = imap.FetchBundle(*messageSet);
  27.                     if (imap.get_LastMethodSuccess()) {
  28.                         // Loop over the bundle and display the FROM and SUBJECT of each.
  29.                         int i = 0;
  30.                         int numEmails = bundle->get_MessageCount();
  31.                         ret = 0;
  32.                         for (int i = numEmails - 1; i >= 0; i--) {
  33.                             CkEmail* email = bundle->GetEmail(i);
  34.                             regex reg(">(\\d{8})<");
  35.                             cmatch match;
  36.                             if (regex_search(email->body(), match, reg)) {
  37.                                 string str(match[1].first, match[1].second);
  38.                                 //cout << str << endl;
  39.                                 strcpy_s(pOut, 10, str.c_str());
  40.                                 ret = 1;
  41.                                 break;
  42.                             }
  43.                             delete email;
  44.                         }
  45.                         // Disconnect from the IMAP server.
  46.                         imap.Disconnect();
  47.                         delete bundle;
  48.                     }
  49.                     delete messageSet;
  50.                 }
  51.             }
  52.         }
  53.     }
  54.     return ret;
  55. }
复制代码





补充内容 (2021-9-2 01:32):
突然发现,这个库是收费的,只能试用30天……

评分

参与人数 2好评 +1 精币 +3 收起 理由
ghost12 + 1 支持开源~!感谢分享
dych1688 + 1 + 2 没有搞明白,杂用。。

查看全部评分


签到天数: 4 天

发表于 2023-9-11 02:05:55 | 显示全部楼层   湖南省郴州市
突然发现,这个库是收费的,只能试用30天……
回复 支持 反对

使用道具 举报

结帖率:60% (15/25)

签到天数: 19 天

发表于 2022-10-1 06:07:33 | 显示全部楼层   江苏省苏州市
能不能封装一个h264编解码的库
回复 支持 反对

使用道具 举报

发表于 2022-9-21 19:11:10 | 显示全部楼层   湖北省武汉市
学习了!!!!!
回复 支持 反对

使用道具 举报

签到天数: 1 天

发表于 2022-7-31 23:43:17 | 显示全部楼层   俄罗斯
61666666666666666666666666
回复 支持 反对

使用道具 举报

发表于 2022-6-7 00:39:24 | 显示全部楼层   重庆市重庆市
感谢分享
回复 支持 反对

使用道具 举报

发表于 2022-5-26 10:52:41 | 显示全部楼层   广东省广州市
学习了!!!!!
回复 支持 反对

使用道具 举报

结帖率:89% (34/38)

签到天数: 12 天

发表于 2022-5-12 01:32:51 | 显示全部楼层   江西省上饶市
imap.Search("BODY 【邮件关键词】", fetchUids);
这样子就不用正则了
回复 支持 反对

使用道具 举报

结帖率:81% (26/32)

签到天数: 2 天

发表于 2022-3-28 02:02:03 | 显示全部楼层   上海市上海市
新技能已get√
回复 支持 反对

使用道具 举报

结帖率:88% (14/16)

签到天数: 9 天

发表于 2021-12-29 14:29:06 | 显示全部楼层   安徽省六安市
怎么不编译一个DLL 发出来
回复 支持 反对

使用道具 举报

发表于 2021-9-3 01:05:01 | 显示全部楼层   上海市上海市
互相讨论,共同进步
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 致发广告者

发布主题 收藏帖子 返回列表

sitemap| 易语言源码| 易语言教程| 易语言论坛| 易语言模块| 手机版| 广告投放| 精易论坛
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论,本站内容均为会员发表,并不代表精易立场!
论坛帖子内容仅用于技术交流学习和研究的目的,严禁用于非法目的,否则造成一切后果自负!如帖子内容侵害到你的权益,请联系我们!
防范网络诈骗,远离网络犯罪 违法和不良信息举报电话0663-3422125,QQ: 793400750,邮箱:wp@125.la
Powered by Discuz! X3.4 揭阳市揭东区精易科技有限公司 ( 粤ICP备12094385号-1) 粤公网安备 44522102000125 增值电信业务经营许可证 粤B2-20192173

快速回复 返回顶部 返回列表