| Отправка почты с вложением из MT4. |
#property strict
#property indicator_chart_window
bool New_Bar;
string _smtp = "smtp.yandex.ru";
int _port = 465;
string _ssl = "true";
string _emailFrom = "from@yandex.ru"; //напишите адрес отправителя
string _emailFromPassword = "**************"; //напишите пароль отправителя
string _emailTo = "to@yandex.ru"; //напишите почту получателя
string _subject = Symbol();
string _message = "Hello";
string _attachmentFileName;
#import "shell32.dll"
int ShellExecuteW(int hwnd,string lpOperation,string lpFile,string lpParameters,string lpDirectory,int nShowCmd);
#import
int OnInit()
{
return(INIT_SUCCEEDED);
}
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
Fun_New_Bar();
if(New_Bar==true)
{
TakeShot();
}
return(rates_total);
}
void Fun_New_Bar()
{
static datetime New_Time=0;
New_Bar=false;
if(New_Time!=Time[0])
{
New_Time=Time[0];
New_Bar=true;
}
}
void TakeShot()
{
_attachmentFileName = Symbol()+IntegerToString(Year())+IntegerToString(Month())+ IntegerToString(Day())+
IntegerToString(Hour())+IntegerToString(Minute())+".jpeg";
string exePath = TerminalInfoString(TERMINAL_DATA_PATH)+"\\MQL4\\Files\\MailWithParams.exe";
string params = _smtp + " " + IntegerToString(_port) + " " + _ssl + " " +
_emailFrom + " " + _emailFromPassword + " " + _emailTo + " " + _subject +" " +
_message + " " + _attachmentFileName;
WindowScreenShot(_attachmentFileName,1920,1080,0,2,1);
Sleep(500);
ShellExecuteW(NULL,NULL,exePath,params,NULL,0);
}
Screener.mq4 (1 Kb)
06 февраля 2022
|
29 сентября 2023
|
Комментарии (0)
Зарегистрируйтесь или авторизуйтесь, чтобы оставить комментарий