MT4或MT5邮件发送功能扩展dll组件源码

chmail.dll是我们采用VC++ Unicode开发一款标准调用的DLL组件,用来弥补一些软件邮件发送问题,如MT4或MT5中SendMail函数无法随意修改端口或者发送一些其它邮件的缺点。可免费下载测试,dll正式版是 500 元 永久使用。带VC++源码是 3000 元。有需要的朋友可联系在线客服。

点击下载程序与源码 文件大小:1.38 MB

MQL4/ MQL4/Libraries/ MQL4/Libraries/chmail.dll MQL4/Libraries/libgsasl-7.dll MQL4/Scripts/ MQL4/Scripts/chmailTest.mq4 策汇在线.url 必须读我.txt

MQL4/Scripts/chmailTest.mq4代码片段:

//+------------------------------------------------------------------+ //| chmailTest.mq4 | //| Copyright 2020, MetaQuotes Software Corp. | //| http://www.fxchs.com | //+------------------------------------------------------------------+ #property copyright "策汇在线 邮件组件chmail.dll 测试脚本" #property link "http://www.fxchs.com" #property version "1.00" #property strict #import "chmail.dll" int chSendMailBySMTP(string Server, // 邮箱服务器SMTP地址 int Port, // 邮箱服务器端口 string User, // 登录邮箱用户名 string Password, // 登录邮箱密码 string From, // 发件人 string To, // 收件人 string Subject, // 主题 string Text, // 内容 string Attachment, // 附件 bool UseHtml, // 是否使用HTML格式 string &Error); // 返回错误,当函数为非0时,返回错误文本 #import //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { int nRet = 0; string strError = ""; string strText = "策汇在线邮件发送扩展DLL测试。。。。"; string strTextSubject = "chmail.dll邮件普通文本发送测试"; string strHTML = "<div style=\"font-size:28px;color:#bb0000;\"><a href=\"www.fxchs.com\" target=\"_blank\">策汇在线</a>邮件发送扩展DLL测试</div><br/><br/><img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADEAAAAwCAIAAAA3ogXuAAAGSklEQVR4Ac2ZBYzcRhSGp1aZmZm5FZYrKHOYmZk5x7e9WicrtVLrGjgIWM3mFGawIusUZmZGqwozJ7/37T47tveU1flOsZ6sjXdm3rf/g5lzxG1jD99S9nnrvwOYRJQ//A8L1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UJKTAFXv3mo7IMlgpiNNIm+ZmM3YeBHr5Op0+fn7V6M9u05fb913GLUeqOACjMVury7fv9WNW4hZavE5hS65m1skS1LNwTFkEXIJF4n39cnobwYUpwCw2HievOOo6zg/fY791ojcL1lie+vE4nczMGlM/UIlKaas8s76yH0CDlCWL19v3oCx4m7MEPs6gFwUxNsv6rcM90GYgRIJr1dDs1LWr4s0pevpuzKriPR8alzJRcJAM16OwhnQof7zQEUnkL5fzll/XFiRosq0Qm+IAn+MOw3bE9xH7YbUS3EbP8UumbLZYqaA8OiQk+Jm23nD0kYu8h1EK377f8WDiF8jnTw9QwOxrIFHymW28FMyFqtaatJ2foWGib5CzWQnVqobwOfUALBVOgTrXTRidlihjrPfWMqvGfVbDPPz9i8elEeb6epQuF2rrTQlGD/u7QzNwMLP85s9bAUTcyqc55vNYIA8e0cYvX406mmevhw59J1SYtR0/HgHY41KY5h1q648mnaSN4Kf4gz9+O3+NnqpHmYgIH6UTVjsIR1dLQtR1rp93Opx/3yamXTgMwhQ9V7rvoNIQXYcMs8uU5+/7er9hhgkgw3iLAd7dquI2I2ZyRPCBZR9W8S8GcvyWxGcjTnPdPA6ATv+jR7NW5bVSF8d93iiFK6W9z6MSxw6Mhq8GEQVXExPuxMk1oi/kN5x996P1TDBDvpoiJU6oqTJuPfV2M2M2vxWr0j8cuZng6ZPnt7sNQpRlFg3IROQPXxACYOu7+ZN91K/a+kLCqQCS7qoS+nwFg9TMT5wKOIEbQG7QqAIJ5XmbCGuWMCfx/BAv5TmQIYrhGKIgGXCAsfu9NImO9TKQh2CGYKNyMmUiyUG01lsXicEHuvEzZrFOQoUHQzBANC2LZcgY0yw3SiUugki3YUdMcOqvcStYwQ78OVGwVLJxs6+cAAAAASUVORK5CYII=\"/>"; string strHTMLSubject = "chmail.dll邮件HTML发送测试"; string strServer = "smtp.qq.com"; // 邮箱服务器 int nPort = 465; // 邮箱端口 string strFrom = "xxxxxxxxx@qq.com"; // 发件人 string strTo = "xxxxxxxxx@qq.com"; // 收件人 string strUser = "xxxxxxxxxx@qq.com"; // 邮箱用户名 string strPassword = "xxxxxxx"; // 邮箱密码 // 多申请点内存空间 StringInit(strError,2024,0); // 发送普通文本 Print("正在测试普通文本邮件发送..."); nRet = chSendMailBySMTP(strServer,nPort,strUser,strPassword,strFrom,strTo,strTextSubject,strText,"",false,strError); if (nRet != 0) { Print("普通文本邮件发送失败!错误:",strError); } else { Print("发送普通邮件成功!"); } // 发送HTML Print("正在测试HTML邮件发送..."); nRet = chSendMailBySMTP(strServer,nPort,strUser,strPassword,strFrom,strTo,strHTMLSubject,strHTML,"",true,strError); if (nRet != 0) { Print("HTML邮件发送失败!错误:",strError); } else { Print("发送HTML邮件成功!"); } // 发送附件前,先写个文本 string terminal_data_path=TerminalInfoString(TERMINAL_DATA_PATH); string filename=terminal_data_path+"\\MQL4\\Files\\chmailTest.txt"; int nHandle = FileOpen("chmailTest.txt",FILE_WRITE|FILE_CSV); if(nHandle!=INVALID_HANDLE) { FileWriteString(nHandle,strText,StringLen(strText)); FileClose(nHandle); } Print("正在测试带附件邮件发送..."); nRet = chSendMailBySMTP(strServer,nPort,strUser,strPassword,strFrom,strTo,strTextSubject,strText,filename,false,strError); if (nRet != 0) { Print("带附件邮件发送失败!错误:",strError); } else { Print("带附件邮件发送成功!"); } } //+------------------------------------------------------------------+