Alerts sent to email

 

Hello all,

I am having and issue sending rate alerts to my email. I have the SMTP information and have entered my details and in the journal I am getting different error messages.

I am getting - a "not enough space error in the journal".

Mail:login to smtp.mail.yahoo.com failed

If anyone knows how to get this to work I would be greatful.

Thanks D.

 

Is the error occurring when you press the "test" button in the options menu or when your code tries to send an email itself? Did you try the "test" button already?

If the problem occurs with the "test" button, then it is most likely a problem with the email settings you entered.

Obviously check your internet security settings and firewall if you haven't done so. The problem may not even be with MT4 at all.

Remember that you cannot send an email from the strategy tester!!! So check if the error is only occurring backtesting or optimization.

To get more specific error information (with error code) place something like this on the line directly after SendMail():

int error = GetLastError(); Print("Last error = "+error+". "+ErrorDescription(error));

(You may need #include <stdlib.mqh> or #include <WinUser32.mqh> in the inputs to get the "ErrorDescription" bit working, I can't remember).

If that doesn't illuminate the problem, then it sounds like the "not enough space" error might be referring to system memory. I have had a few crashes of MT4 caused by overloaded memory. Try reducing load on system or checking the health of your memory.

Failing that, post the relevant piece of code you are using, and that might reveal the problem.

 
RaptorUK show this somewhere https://www.mql5.com/en/forum/46410
 

hmm .. that looks like a can of worms to fix. I think the original advice is probably the easiest course of action. "Send mail more rarely".

Perhaps you can amalgamate all the info you want to send into a smaller number of emails - or even write to file and don't bother sending emails at all (if you are simply looking for a record of data to be used later or at the same time by another programme).

Remember that you can also use StringConcatenate() (or a similar ad hock approach) to add together all the strings produced during one complete run through of the code (ie. during one tick), and then send that string all at once.

That would dramatically cut down on the number of emails if you are sending more than one per tick.

Also, you could write this string to file at the end of the tick, then add it to strings written during other ticks, and then email all THOSE strings in one batch at every nth tick if you are still producing a lot of data.

(Remember to use "\n" to separate lines in the string. That makes it much more manageable.)

Reason: