Sending Mail has long delay every time

 

I decided to use the email notification feature for the first time. I opened the Options in MT4 and configured my email address, SMTP etc. Then I pressed the Test button. MT4 said:

Message was successfully queued!
Look at journal for more information

But then I checked my email and received nothing. I checked the configuration in Options. Everything seemed to be correct. I pressed the Test button again.

Still nothing. I checked the Journal tab and saw no indication of any email activity whatsoever.

I pressed the Test button again. I checked my email and received nothing. Other test messages arrived instantly (my cell phone beeps). None of the MT4 Test messages would arrive. The Journal tab seemed very silent too.

Something like this process was repeated about a dozen times. Each time ended in frustration.

Stumped, I was staring at the Journal tab trying to figure out what to do next when I saw a dozen lines suddenly scroll by informing that 'Test message' had been sent. Puzzled, I checked my email and sure enough, a dozen Test messages were in my mailbox.

So I opened the Options and pressed the Test button again. The same thing happened. MT4 only sent the Test message 11 minutes later.

Then again, 7 minutes later.

Then again, 5 minutes later. (And I wonder if the interval becomes shorter with every new test...)

Why does this happen? Can MT4 not send email messages instantly?

TIA

 
whoowl:

I decided to use the email notification feature for the first time. I opened the Options in MT4 and configured my email address, SMTP etc. Then I pressed the Test button. MT4 said:

Message was successfully queued!
Look at journal for more information

But then I checked my email and received nothing. I checked the configuration in Options. Everything seemed to be correct. I pressed the Test button again.

Still nothing. I checked the Journal tab and saw no indication of any email activity whatsoever.

I pressed the Test button again. I checked my email and received nothing. Other test messages arrived instantly (my cell phone beeps). None of the MT4 Test messages would arrive. The Journal tab seemed very silent too.

Something like this process was repeated about a dozen times. Each time ended in frustration.

Stumped, I was staring at the Journal tab trying to figure out what to do next when I saw a dozen lines suddenly scroll by informing that 'Test message' had been sent. Puzzled, I checked my email and sure enough, a dozen Test messages were in my mailbox.

So I opened the Options and pressed the Test button again. The same thing happened. MT4 only sent the Test message 11 minutes later.

Then again, 7 minutes later.

Then again, 5 minutes later. (And I wonder if the interval becomes shorter with every new test...)

Why does this happen? Can MT4 not send email messages instantly?

TIA

It may not be a MT4 problem exactly. You would have to monitor the communications over the network, to see if it is indeed MT4 delaying it, or if it is a delay caused by the SMTP Server for your mail service.

Since MT4 is using old style unencrypted port 25 SMTP communications, your email server my be blocking it or slowing it down, since many old SPAM bots use that old method.

Noways, most email clients use modern encrypted delivery techniques, so it could be that your email server is simply handling the old method at the lowest priority.

This is simply speculation on my end, as I obviously have no access to your system to be able to verify it.

You will have to investigate this on your system to find out, either by setting up a local SMTP port 25 handler and using it for the test, or installing port sniffer driver to log all the network activity and see what is happening.

 

As a followup, I found this SMTP (port 25) testing tool as a result of a Google search. It is quite old but it may be of help in this case to test if it is a MT4 issue or a mail server issue:

Test Mail Server Tool - https://toolheap.com/test-mail-server-tool/

EDIT: remember to set in MT4 the "SMTP Server" to 127.0.0.1 or local ip of the computer you are using the tool on.

Test Mail Server Tool
  • toolheap.com
Test Mail Server Tool is a mail (SMTP) server emulation to test mail function on localhost without having to install a mail server.
 

Thank you for your comments, Fernando.


Well, I have a local SMTP running and the problem is confirmed. I can send email from the command line, and the messages reach the mailbox immediately. I also sent messages from my MUA and the messages arrive immediately. Messages sent from MT4 still take a long time to be sent.


Note that they don't take a long time to arrive. They take a long time to be sent. For example, I look at the clock and send a couple of messages at 11h23. Nothing happens. Eventually, the Journal tab shows them being sent at 11h29. Each message (right column) is accompanied by its time stamp (left column). That time stamp says "11h29." When I check my mailbox, the time stamp on each message is "11h29," not "11h23."


I'm not using the Test button anymore. I'm using this mini EA to test the email feature:

int OnInit()   {
        EventSetMillisecondTimer(1000);
        return(INIT_SUCCEEDED);
}

void Loop()    {

        if (FileIsExist("send", FILE_COMMON)) {
           Print("Sending mail");
           bool sent = SendMail("MT4 subject", "MT4 message");
        }

}

void OnTimer()    {
   Loop();
}


Again, thank you for your attention.

 

whoowl: Well, I have a local SMTP running and the problem is confirmed. I can send email from the command line, and the messages reach the mailbox immediately. I also sent messages from my MUA and the messages arrive immediately. Messages sent from MT4 still take a long time to be sent.

Note that they don't take a long time to arrive. They take a long time to be sent. For example, I look at the clock and send a couple of messages at 11h23. Nothing happens. Eventually, the Journal tab shows them being sent at 11h29. Each message (right column) is accompanied by its time stamp (left column). That time stamp says "11h29." When I check my mailbox, the time stamp on each message is "11h29," not "11h23."

I'm not using the Test button anymore. I'm using this mini EA to test the email feature:

Can you please clarify? Are you saying that the "Test" button has a delay, but when you use the EA, the message is send immediately?

EDIT: Can you please also tell us which build you are using?

 

Version 4.00 build 1330, 19 Mar 2021.


The delays happens either way, with the Test button or from the EA.

 
whoowl:

Version 4.00 build 1330, 19 Mar 2021.

The delays happens either way, with the Test button or from the EA.

Its been a while since I used the mail feature on MetaTrader 4, so this could be something that is only happening on recent builds, but previously I did not have the problem.

I will do some testing on the current build and get back to you in a few minutes to see if I can replicate the situation.

 

Just did a few tests on my own system with a remote SMTP server, via port 25 and it was send immediately with the Test button. There was absolutely no delay at all!

Could something on your machine, be blocking it? Maybe some Anti-Virus or Anti-SPAM mechanism that is causing the communication to fail and delay the procedure?

What version of windows are you using? I'm using Windows 10 Pro 64-bit Version 20H2 Build 19042.928

 

I don't have any Anti-Virus or Anti-SPAM running in background.

Please note, the emails are sent with a delay, not received. The delayed log messages in the Journal tab show that very clearly. As soon as the log is posted, the messages reach my mailbox immediately.

I'm running MT4 on Linux. I was afraid of that question... :-(

 
whoowl:

I don't have any Anti-Virus or Anti-SPAM running in background.

Please note, the emails are sent with a delay, not received. The delayed log messages in the Journal tab show that very clearly. As soon as the log is posted, the messages reach my mailbox immediately.

I'm running MT4 on Linux. I was afraid of that question... :-(

No, in my case there is no delay in sending or receiving. I actually tested it against a remote server in a another city (aprox. 300km away) and just after clicking the test button, the message appeared in my inbox via Microsoft Outlook client running on my PC. So, it was a complete round-trip in a fraction of a second.

As for the Linux part, I really can't comment on how that may affect the situation.😉