How can I send email
Hi all
How can I send email to an email address in MQL5?
MQL5 Function: SendMail
Note
Sending can be prohibited in settings, email address can be omitted as well. For the error information call GetLastError().
SendMail() function does not work in the Strategy Tester.
MetaTrader 5 Setting: Email — email parameters for sending messages straight from the platform;
Mailbox is configured on this tab. These settings will be then used to send message by the Expert Advisor command or by a triggered alert.

- www.mql5.com
Example: the adviser at the time of the birth of a new bar sends an email with the text "I'm alive!"
//+------------------------------------------------------------------+ //| Send email.mq5 | | //+------------------------------------------------------------------+ #property version "1.00" //--- datetime m_prev_bars = 0; // "0" -> D'1970.01.01 00:00'; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- //--- we work only at the time of the birth of new bar datetime time_0=iTime(Symbol(),Period(),0); if(time_0==m_prev_bars) return; m_prev_bars=time_0; //--- Send Mail SendMail(__FILE__,"Symbol: "+Symbol()+", I'm alive!"); } //+------------------------------------------------------------------+
- emails when my account takes a trade
https://www.mql5.com/en/forum/171346
- Experts: Mail All Order Status Periodically
https://www.mql5.com/en/forum/34775#comment_3849164
- 2017.03.01
- www.mql5.com
Hi all
How can I send email to an email address in MQL5?