Is there any other way to send email without using SendMail() function?

 

Hi all,

I'd like to create an EA to send email but without the option to setup the MT5 with the mailserver name, port, etc.


I'm searching and the other possible solution is to use socket, is it right?

If so, is there any article or documentation you can point me to read and better understand its functionality besides of MQL5 documentation?

Thanks,

Ademir

 
scademir: Hi all, I'd like to create an EA to send email but without the option to setup the MT5 with the mailserver name, port, etc. I'm searching and the other possible solution is to use socket, is it right? If so, is there any article or documentation you can point me to read and better understand its functionality besides of MQL5 documentation? Thanks, Ademir

You can use DLL calls or create your own SMTP client with MQL5 Sockets. Another option is to use a service provider that offers a web-api for email, or maybe create your own external mail relay server with a web-api, which you can call with WebRequest.

As for documentation on sockets, you can study general information on the web about windows sockets or even *nix based sockets.

You will also have to learn about the SMTP protocol.

Documentation on MQL5: Network Functions
Documentation on MQL5: Network Functions
  • www.mql5.com
Network Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

Thank you Fernando,

I'll take a look at the possibilities you mentioned.

 
Fernando Carreiro #:

You can use DLL calls or create your own SMTP client with MQL5 Sockets. Another option is to use a service provider that offers a web-api for email, or maybe create your own external mail relay server with a web-api, which you can call with WebRequest.

As for documentation on sockets, you can study general information on the web about windows sockets or even *nix based sockets.

You will also have to learn about the SMTP protocol.

Fernando,

I'm running some tests with Sockets and the communication only works when I enter the website in the Tools > Options > Expert Advisors > "Allow WebRequest for listed URL"


Is there any other way to bypass this configuration?

I think there is since I saw a Script from another guy who send email and I do not need to configure anything in the MT


Thanks,

Ademir

 
Ademir Santos #: I'm running some tests with Sockets and the communication only works when I enter the website in the Tools > Options > Expert Advisors > "Allow WebRequest for listed URL". Is there any other way to bypass this configuration? I think there is since I saw a Script from another guy who send email and I do not need to configure anything in the MT.

No, it is part of MetaTrader's sandbox security. One option however, is to use DLL calls to the Windows API.

 
Fernando Carreiro #:

No, it is part of MetaTrader's sandbox security. One option however, is to use DLL calls to the Windows API.

I'm going to check the DLL calls.

I want to avoid users interactions.


Thanks again,

Ademir

 
Ademir Santos #:I'm going to check the DLL calls.I want to avoid users interactions.

Please note, that if you plan to sell it on this sites Market, you will not be allowed to use DLL calls.

Even if you sell it externally, the end user will also not be able to use MQL5 VPS service either because DLL calls are not allowed.

Reason: