Sending email to different addresses

 

Hi,

I set the email destination to one account, e.g. to my hotmail account.

When a certain case happens, I want to send to another email account (which is pointed to an email-to-sms service, which will end up as an sms to me).

How do I do this as there is only one email address input in the MT4? Is my EA able to change that email address set at the MT4?

 

One way to do it would be to send all your mail to an account on a service (such as Googlemail) which allows you to set rules such as:

- if message subject contains "Order Opened" or "Order Closed", "fan out" the message to user1,user2,user3

- if message subject contains "Error", send the message to the email/SMS gateway.


CB

 
// MAILLINK
// http://www.fx1.net/maillink.php
//
// Please note: importing functions must be enabled 
// inside MT4 Terminal to be able to use functions
// from addons like here.
//
// Demonstration code
// Sends simple email

// importing functions from .dll
#import "maillink.dll"
   int      MailInit(string,int,string,string);
   int      MailAddHeader(int,string);
   int      MailResetHeader(int);
   int      MailSend(int,string,string,string,string);
   string   MailVersion();
   string   MailErrorString(int);
   int      MailClose(int);
#import

int start()
  {
   int smtp = MailInit("smtp.provider.com",25,"yourlogin","yourpassword");
   if (smtp>0)
      {
      // success
      MailAddHeader(smtp,"Reply-To: noreply@test.com");
      MailAddHeader(smtp,"CC: secretary@test.com");
      MailAddHeader(smtp,"X-Symbol: "+Symbol());    
      // edit these settings to your smtp   
      int ret = MailSend(smtp,"mt4@domain.com","your@domain.com","This is subject"
      ,"And this is\nmultilined\nbody.\nHave fun");
      if (ret == 0 ) { Print ("Successfully sent."); } 
               else  { Print ("Error in sending. See debug: "+MailErrorString(smtp)); }
      }
     return(0);
  }

 
Does it will work if I do the followings:

1. Open/Close a Pending Order
2. Open/Close a Position
 
jcadong5:

How do I do this as there is only one email address input in the MT4? Is my EA able to change that email address set at the MT4?

did you try to add multiple adresses separated by a comma?

like this:

foo@example.com, bar@example.com, foobaz@example.com

(I have not tested this but it would be the first thing I would try since multiple addresses separated by comma it is a valid syntax for the SMTP protocol)

[edit:] forget my answer, I didn't read your question.

 
-> 7bit, multiple addresses are not supported in the MT4 email implementation.
And of course, there are a number of ways around this.

CB
 
You can forward the e-mail-s from the mailbox to other mail addresses.

You can program it by using different words (variables) in the subject. For example you say to the mailbox filter:

if the subject consist 'The sun is shining' forward it to the sunshine@gmail.com
else forward the mail to the cloudy@gmail.com
 
Lol Relative - there's an echo in here. Check my earlier post.

CB
 
Oh, yes Cloudbreaker!

I was careless. Sorry!
 
Where can I get "maillink.dll"
maillink.dll
 
alex198555:
Where can I get "maillink.dll"

Cant download it, is there another location for download the dll ?