Another Failed Email Send Topic, but this time it's different

 

Keeping things simple, I have an MQL4 program that sends a daily report email.

Some days the email will send, other days I get two "Mail: login to smtp.gmail.com:465 failed" in the journal.

On the days it fails, I click the "Test" button in the Email tab under Options and it then sends the email it was supposed to send along with the test email successfully.


So my question is why is the email sending intermittently working?
 
Bump
 
lancervi50 #:
Bump
Could be either end but how good is the smtp service would be my first question 
 
lancervi50: So my question is why is the email sending intermittently working?

IIRC, the maximum limit on emails, is just like SendNotification: “no more than 2 calls per second and not more than 10 calls per minute.” Add a Sleep(6) (or indicator equivalent) after the Send… and wrap a mutex around both (for multiple charts).

 
lancervi50:

Keeping things simple, I have an MQL4 program that sends a daily report email.

Some days the email will send, other days I get two "Mail: login to smtp.gmail.com:465 failed" in the journal.

On the days it fails, I click the "Test" button in the Email tab under Options and it then sends the email it was supposed to send along with the test email successfully.


So my question is why is the email sending intermittently working?
SendMail() is a function returning false in case of failure, with an error code, did you check it ?
 

@Paul The SMTP is gmail so it shouldn't be an issue, I reckon William found my issue so I'll try that solution.

@William, I think you found my issue. I made a bad practice because I was lazy, of sending the email at an exact time (second resolution) but from multiple pairs so it bunches them up. I don't mind the multiple emails coming into the inbox, and it seemed to work....until it didn't.
I'll mod the code to send from a single pair and add a sleep so it doesn't try to send multiple emails out in that second. Thanks for the help.

@Alain, I didn't realise functions returned an error code in the logs, thought it was just in the journal only verbose. Thanks, now I know.
Reason: