Email function not working in EA....but works for MT4

 

Someone is programming an EA for me. When the order is triggered it is supposed to send me an email, but it is not for me. It is working for the programmer on his platform.

So I thought it is something wrong with mine. I tried it on 2 different broker demos and get the same result. An email alert on the Alerts tab works. Also the Test button on Tools\Options\Email tab is working. So that tells me my SMTP settings are good.

Is there a setting in MT4 specific to EA's that I am not seeing? Here is a screenshot of the first tab of the EA.

Not sure if this is relevant, my email client is Outlook 2003.

This is the basic structure of the code being used, but it is working for the programmer so I suspect that is not the problem:

SendMail( string subject, string some_text)

Summary:

EA email works for programmer

Alert email works for me on 2 platforms

Test button on Tools\Options\Email tab is working

EA email doesn't work for me

I have a feeling I am missing something obvious.

Thanks in advance for any help.

 

I may just give your some links because emails subject was fully discuss on our forum.

Look at here https://www.mql5.com/en/forum/174336

 
newdigital:
I may just give your some links because emails subject was fully discuss on our forum. Look at here https://www.mql5.com/en/forum/174336

Yes, I know about that thread. I read it before I posted. It didn't address my issue, at least not from what I could see. That is why I posted. Here is my summary again:

Summary:

EA email works for programmer

Alert email works for me on 2 platforms

Test button on Tools\Options\Email tab is working

EA email doesn't work for me

 

You have verified that the EA reaches the SendMail line? (Print before and after)

 
ralph.ronnquist:
You have verified that the EA reaches the SendMail line? (Print before and after)

Not being a programmer I will try to answer your question. Hope I get it right.

I probably should have included this in my first post. It is the journal entries. After the order is placed it is supposed to email:

01:39:35 Mail: 'EA#2 Update' has been sent

02:59:28 Alert: bid > 0.6608

02:59:28 Mail: 'EURGBP' has been sent

06:47:00 Expert EA#2mod2 xxxxxx,Daily: removed

06:47:01 MultiBank Trader 4.00 build 201 stopped

07:53:23 MultiBank Trader 4.00 build 201 started

07:53:23 Expert EA#2mod2 xxxxxx,Daily: loaded successfully

07:53:25 'xxxxxx': login (4.00, #xxxxxxxx)

10:10:57 Mail: 'EA#2 Update' has been sent

10:12:02 Mail: 'EA#2 Update' has been sent

10:12:15 Mail: 'EA#2 Update' has been sent

10:14:34 Mail: 'EA#2 Update' has been sent

10:16:29 Mail: 'EA#2 Update' has been sent

10:17:05 Mail: 'EA#2 Update' has been sent

10:17:18 Mail: 'EA#2 Update' has been sent

10:22:30 Mail: 'EA#2 Update' has been sent

10:23:11 Mail: 'EA#2 Update' has been sent

10:27:34 Mail: 'EA#2 Update' has been sent

10:27:51 Mail: 'EA#2 Update' has been sent

10:39:27 Mail: 'EA#2 Update' has been sent

The first line above looks like it sent the email, but I never get it.

Next is the alert I did as an email test. I received it.

Later in the log it appears to be trying repeatedly. I never received an email.

 

It appears that the problem is internal to the program, esp since you have verified email sending with the "test" button in the "tools/options/email" dialog.

It then appears that the sending is attempted (i.e. SendMail is invoked), but fails part-ways, and that would indicate a problem with the email contents, or that there is something with the email contents that your "outgoing server" finds upsetting:

* possibly there are newlines in the subject text, and it doesn't like that?

* possibly there are "funny control characters" in the body text?

I think the point is that you and your programmer use different "outgoing servers" for email; well, that's a question, rather, because if you don't then it gets even more peculiar . But if you do, then I think my theory about funny contents would be the next in line to be ruled out.

Can you show the code that composes and sends the email?

 

Snuffleupagus,

I too am having the same problems as you.

I just came across this thread by Codersguru.

I will try to see if it can help me.

Try this link and see if it helps it can help you solve the problem.

https://www.mql5.com/en/forum

 
ralph.ronnquist:
It appears that the problem is internal to the program, esp since you have verified email sending with the "test" button in the "tools/options/email" dialog.

It then appears that the sending is attempted (i.e. SendMail is invoked), but fails part-ways, and that would indicate a problem with the email contents, or that there is something with the email contents that your "outgoing server" finds upsetting:

* possibly there are newlines in the subject text, and it doesn't like that?

* possibly there are "funny control characters" in the body text?

I think the point is that you and your programmer use different "outgoing servers" for email; well, that's a question, rather, because if you don't then it gets even more peculiar . But if you do, then I think my theory about funny contents would be the next in line to be ruled out.

Can you show the code that composes and sends the email?

Thanks for your post and everyone that posted their help.

You are correct. There was something in the email that his environment handled, but mine did not. There was a "#" in the email title and a "@" and ":" in the body. He cleared that out of the EA code and I tested it. The email function worked.

I noticed this time when an email was sent a little envelope icon comes up in the Windows systray. This is normal when Outlook sends an email. I don't recall this ever coming up before the EA was corrected, but my memory could be wrong. I think the systray icon is my antivirus scanning the email as it is sent. So if my memory is correct about not seeing the icon before, then the issue is probably the antivirus or possibly Outlook. I am leaning towards the antivirus being the cause.

Reason: