Download MetaTrader 5

Does anyone have a documented way of using the email function for "sendmail()"???

To add comments, please log in or register
ron
154
ron  

I have yet to find a post where someone shows a step-by-step guide to getting the sendmail to work. I have tried using many different smtp outgoing email sites...but they all seem to use SSL or something because they all fail to connect. If anyone out there has been able to get the email to work please let me know how you did it :-)


I'm sure I'm not the only one out there with this headache of a question ;-)

slacktrader
424
slacktrader  

I tried to solve this too, some time before, but not successfull. Then I switched to gSendMail from here: http://www.metatrader.info/node/108

I do not know if it helps to you, because I use it on VPS with local mailserver and profile installed.

I use it to send me an alerts and screenshots, when some defined events occur.

cloudbreaker
1577
cloudbreaker  
rortiz77:

I have yet to find a post where someone shows a step-by-step guide to getting the sendmail to work. I have tried using many different smtp outgoing email sites...but they all seem to use SSL or something because they all fail to connect. If anyone out there has been able to get the email to work please let me know how you did it :-)


I'm sure I'm not the only one out there with this headache of a question ;-)

I use SendMail() extensively in EAs.


The key point is that SendMail() in MT4 does support authenticated connection to SMTP servers, but not SSL.


There are really only a couple of steps:


1. Configure the Email tab (Tools|Options|Email) in the MT4 platform with the SMTP server connection settings (as you would in any eMail client such as Outlook)

- if you need to change the server port number, just use the format <ipaddress>:<port>

- ensure the "Enable" checkbox is ticked

- ensure that the "From" address is appropriate to your authenticated identity, if your SMTP provider requires this

- click the "Test" button, check any error codes in the Journal

- if the Journal tells you the email has been sent, check whatever account you've sent it to


2. Implement the SendMail(string subject, string body) function in your EA

- I extensively use the StringConcatenate() function call within EA functions in order to gradually build "sMessageBody" within various conditional statements before finally issuing the SendMail() function call


Let me know how you get on.


CB

JC
1592
JC  
cloudbreaker:

The key point is that SendMail() in MT4 does support authenticated connection to SMTP servers, but not SSL.

As a slight caveat - which CB and I have discussed before in https://forum.mql4.com/21008 - I don't believe that MT4 is doing a 100%-perfect implementation of SMTP authentication. Some non-SSL server details which work in other software (e.g. the System.Net.Mail class in .NET) do not work with MT4. In more concrete, practical terms, I've got Yahoo premium accounts to work with MT4, but not standard Yahoo accounts - despite the fact that Yahoo does support non-SSL connections over port 587.

ron
154
ron  
cloudbreaker:

I use SendMail() extensively in EAs.


The key point is that SendMail() in MT4 does support authenticated connection to SMTP servers, but not SSL.


There are really only a couple of steps:


1. Configure the Email tab (Tools|Options|Email) in the MT4 platform with the SMTP server connection settings (as you would in any eMail client such as Outlook)

- if you need to change the server port number, just use the format <ipaddress>:<port>

- ensure the "Enable" checkbox is ticked

- ensure that the "From" address is appropriate to your authenticated identity, if your SMTP provider requires this

- click the "Test" button, check any error codes in the Journal

- if the Journal tells you the email has been sent, check whatever account you've sent it to


2. Implement the SendMail(string subject, string body) function in your EA

- I extensively use the StringConcatenate() function call within EA functions in order to gradually build "sMessageBody" within various conditional statements before finally issuing the SendMail() function call


Let me know how you get on.


CB

I've tried to get this to work with my gmail account...and never works. I've also tried Yahoo...and the same thing. What email do you use? Is it free?

cloudbreaker
1577
cloudbreaker  
rortiz77:

I've tried to get this to work with my gmail account...and never works. I've also tried Yahoo...and the same thing. What email do you use? Is it free?

I don't use a free SMTP service.

I have heard of folk getting Yahoo! to work by pointing MT4 at port 587 on the Yahoo! smtp server.


CB

ron
154
ron  
cloudbreaker:

I don't use a free SMTP service.

I have heard of folk getting Yahoo! to work by pointing MT4 at port 587 on the Yahoo! smtp server.


CB

So what paid service do you use?

JC
1592
JC  
rortiz77:

So what paid service do you use?

I know people successfully using Yahoo Mail Plus accounts. If memory serves me correctly, CB uses a BT Yahoo account, which is probably the same thing.


It's also possible to do the following as a free alternative to using a paid-for service:


  • Install Microsoft IIS.
  • Install the SMTP Virtual Server for IIS (making sure either that remote access to port 25 is blocked by a firewall, or that relaying is disabled).
  • Configure MT4 to connect to port 25 on localhost. No need for a username or password.


Works pretty well, partly because IIS's mail queue is more robust than MT4's mail queue if any outbound-connection problems occur. (But if you need to ask how to do any of the above steps, this probably isn't the right solution for you.)

ron
154
ron  
jjc:

I know people successfully using Yahoo Mail Plus accounts. If memory serves me correctly, CB uses a BT Yahoo account, which is probably the same thing.


It's also possible to do the following as a free alternative to using a paid-for service:


  • Install Microsoft IIS.
  • Install the SMTP Virtual Server for IIS (making sure either that remote access to port 25 is blocked by a firewall, or that relaying is disabled).
  • Configure MT4 to connect to port 25 on localhost. No need for a username or password.


Works pretty well, partly because IIS's mail queue is more robust than MT4's mail queue if any outbound-connection problems occur. (But if you need to ask how to do any of the above steps, this probably isn't the right solution for you.)


Well this sucks...just paid the $19.99 and it still doesn't work :-(


I'm using:
SMPT: plus.smtp.mail.yahoo.com:465
Login: my username

PAss: my pass

From. my new yahoo email

TO: my destination email



Did I miss something?

JC
1592
JC  
rortiz77:

Well this sucks...just paid the $19.99 and it still doesn't work :-(

[...]

Did I miss something?

A quick dip into one of the production servers says that I've got associates successfully using "plus.smtp.mail.yahoo.com" for the server (i.e. port 25) and "<username>@yahoo.com" as both the username and from-address. May require some sort of switch to be turned on within Yahoo Mail...

ron
154
ron  
jjc:

A quick dip into one of the production servers says that I've got associates successfully using "plus.smtp.mail.yahoo.com" for the server (i.e. port 25) and "<username>@yahoo.com" as both the username and from-address. May require some sort of switch to be turned on within Yahoo Mail...

Any idea what this switch is? where it may be located?
12
To add comments, please log in or register