Loading...
 

Overview

 

The MQL Mail module is a very easy to use email client. In contrast to the SendMail function that ships with MetaTrader you have the following advantages:

  • You can send plain text or HTML formatted text.
  • You can send emails to multiple recipients at once (any number of TO, CC, BCC recipients that your mail provider supports).
  • You can send multiple attachments at once.

This way it is very easy to send fully featured reports of your MetaTrader activities including charts and figures and many more by just a few lines of MQL code.

Currently only sending emails via SMTP protocol over secured connections is supported. Receiving emails might be added later if there is any need for this. For a full list of functionalities see


A very basic example is provided by this MQL snippet:

string recipients[] = {"to:recipient1 <r1@sten.info>", "to:r2@sten.info", "cc:r3@sten.info", "bcc:r4@sten.info"};
string attachments[1];
attachments[0] = TerminalInfoString(TERMINAL_DATA_PATH) + "\\MQL5\\Libraries\\"+"photo.png";
resultOfSendMail = MailModule::SendMail("StEn <test@sten.info>", recipients, "test subject", "plain text body", "<b>html</b> body", attachments);