Download MetaTrader 5
To add comments, please log in or register
Develop applications to order. Make profit using Freelance service!
mithun v vijayan
43
mithun v vijayan 2013.12.19 10:57 

I had created an EA, which sends e mail, when a cross and close happens. My SMTP server is smtp.com:2525. The problem is, the mail gets send (even test mails) some times and sometimes not. Though GetLatError() returns 0, the error pops up in the journal.

The latest one was Mail:Error connecting to smtpcorp.com:2525

I would like to know, how to write code to retrieve these kinds of errors from the journal, so that the EA can retry sending the email (may be after waiting for a while) until the confirmation message is received from the journal.

I searched for it in this forum, but was unable to find any thread on this specific problem. Please Help.

mithun v vijayan
43
mithun v vijayan 2013.12.19 11:51  
guys please help
Simon Gniadkowski
Moderator
17998
Simon Gniadkowski 2013.12.19 12:34  
Please do not double post, I have removed your other identical thread . . . next time I will BAN you.
mithun v vijayan
43
mithun v vijayan 2013.12.19 14:53  
RaptorUK:
Please do not double post, I have removed your other identical thread . . . next time I will BAN you.

Ok. Sorry. Wont do it again
mithun v vijayan
43
mithun v vijayan 2013.12.19 15:42  
RaptorUK:
Please do not double post, I have removed your other identical thread . . . next time I will BAN you.
I understand why no one is interested in my request. I find that a lot of discussion have happened on this topic before. And you yourself have provided links to other forums where some kind of SMTP relay can be set up in the computer. Though I cannot make head and tail of it, I think, I at least have a direction for how to solve the problem. Thanx
Simon Gniadkowski
Moderator
17998
Simon Gniadkowski 2013.12.19 15:55  
finaccfun:
I understand why no one is interested in my request. I find that a lot of discussion have happened on this topic before. And you yourself have provided links to other forums where some kind of SMTP relay can be set up in the computer. Though I cannot make head and tail of it, I think, I at least have a direction for how to solve the problem. Thanx
No, the issue is that what you want to do is not simple, the best solution is to get a reliable email service, and for that you probably have to pay . . . but you probably want it for free.

To read the log you can't use FileOpen(), FileReadString(), etc. because the log is outside of what the file functions can access so you have to use WinAPI just to get to the file . . . then you have to parse it to find the relevant log entry . . . if there is one. Maybe you are capable of coding all that . . . go for it.
mithun v vijayan
43
mithun v vijayan 2013.12.19 16:42  

Yeah, you are right :). I was hoping to find a free and reliable service. But I guess that's not possible. So I downloaded the hmail server software. I am trying to configure my router to provide a static IP. This idea, I got from one of the forums, which, the link you had posted in some other thread.

The method you suggested about, using WinAPI, I don't know if I am yet capable. But if the method I mentioned ( about hmail server) doesnt work, then I will definitely do it.

Thanx a lot. Really Appreciate.

Ex Ovo Omnia
3111
Ex Ovo Omnia 2013.12.19 18:11  
finaccfun:

...I am trying to configure my router to provide a static IP....

I am not sure what you mean by the sentence above... supposing you bought a static IP address, it is usually more expensive than buying a web-hosting with a reliable SMTP service (~$1/month).
Moreover, currently a lot of email relays do not accept messages from custom local SMTP servers, because they are misused for flooding spam.

I wonder if WinAPI could read the log file including the cached-only content, but since both handles belong to the same application, it probably would.

mithun v vijayan
43
mithun v vijayan 2013.12.20 04:43  
Ovo:

I am not sure what you mean by the sentence above... supposing you bought a static IP address, it is usually more expensive than buying a web-hosting with a reliable SMTP service (~$1/month).
Moreover, currently a lot of email relays do not accept messages from custom local SMTP servers, because they are misused for flooding spam.

I wonder if WinAPI could read the log file including the cached-only content, but since both handles belong to the same application, it probably would.


""EDIT: After the recent updates of MT4 which disallow the use of localhost and 127.0.0.1 for SMTP server host, extra steps needs to be taken in order to use your actual IP address instead.

If you have a static IP address from your ISP and your computer is directly connected to the internet without connecting through a router, then you should already know your IP address.

But if you’re like the million others who shares a single internet connection with other home computers via a router (wired or wireless), then your computer might be using DHCP (meaning your IP address might change the next time you switch it on and connect to your router). You can set your router such that your computer that’s running MT4 will always be getting the same IP address. As router setup defers from one manufacturer to another, you’ll need to figure that part out yourself.""

This is an excerpt from a document file from a forum which was directed towards, by RaptorUK, on a similar problem. This was what I was mentioning about.

mithun v vijayan
43
mithun v vijayan 2013.12.20 04:49  

Ovo:

I am not sure what you mean by the sentence above... supposing you bought a static IP address, it is usually more expensive than buying a web-hosting with a reliable SMTP service (~$1/month).
Moreover, currently a lot of email relays do not accept messages from custom local SMTP servers, because they are misused for flooding spam.

I wonder if WinAPI could read the log file including the cached-only content, but since both handles belong to the same application, it probably would.



And even if I uses a reliable SMTP service, sometimes the getlasterror() returns zero, but in the journal, an error is recorded such as Mail:Error connecting to smtpcorp.com:2525. So either I need to access the logs, or atleast a better method than relying on SMTP service.
Ex Ovo Omnia
3111
Ex Ovo Omnia 2013.12.20 08:19  
finaccfun:


And even if I uses a reliable SMTP service, sometimes the getlasterror() returns zero, but in the journal, an error is recorded such as Mail:Error connecting to smtpcorp.com:2525. So either I need to access the logs, or atleast a better method than relying on SMTP service.

Ok, so look for the file handling using winAPI.

I myself have been using even more complicated way, using wininet. I send a http post to the php script, and I have no feedback if it worked :) but I did not notice any missing mail so far.

But if the hosting site turns unavailable, the http post takes 15 seconds until expired, blocking the script/indicator. Fortunately it happens rarely.

/ /12
To add comments, please log in or register