MT4 Email Alert – Setup Your MetaTrader in 4 Easy Steps

mt4 email alert

Greetings friends!

In this short article we will discuss how to setup your Expert Advisor so to get an MT4 email alert every time a significant event occurs. A significant event can be anything like successful execution of an order, or a position being closed at StopLoss, or even simply the price crossing a certain level. It’s up to you to decide when you want your FX Robot to send an email notification.

Step 1 – Open a Gmail Account

It is important to understand that MetaTrader 4 cannot send an MT4 email alert on its own. The only way your trading platform can do this is through an existing email account.

Of course, for this purpose you can use your personal email account. However, that way you may run into complications when configuring the SMTP server. Gmail is tried and tested, and generally speaking, I find that this is the easiest approach. I created myself one just now:
gmail account

One more thing.. You know how Gmail allows you to set up two-step verification? Well, this time don’t do it. MetaTrader 4 will not be able to access your Gmail account if two-step verification is in place.

After you’re done, you can logout of your new Google account. You won’t ever need to log into it again.

Step 2 – MetaTrader 4 Settings

Open your MT4 trading platform and go to Tools -> Options or simply click CTRL+O. Now enter the following settings in the Email tab:

email setup

The “SMTP login” and the “From” fields are identical and should reflect the Gmail account you set up in Step 1. The “To” field is where you want your emails to go, i.e. your private email address where you want your MT4 email alert to be delivered.

It so happens that my private email address is also hosted on Gmail. But yours can be anywhere – yahoo / mail.com / gmx / even an email on your personal website. Literally any email address you use can go in this field.

Click OK.

After you have completed this step it is absolutely imperative that you restart MetaTrader 4. Your settings won’t work until you restart the platform.

Step 3 – Test The Configuration

Once you have restarted the platform, go back to the options screen and click the “Test” button. You will get the following message:

test email

It may take the email a couple of minutes to be sent (not more than 5 minutes). If you have set up everything correctly, then the terminal journal should eventually display the following message:

MT4 email alert

If something is wrong, the trading terminal will let you know by displaying an error message in the journal.

Check your personal email – you should have received the test message:

mql4 email

Step 4 – Send an MT4 Email Alert

Finally, everything has been set up and we can send an MT4 email alert from within our own algorithmic trading system. Today I will quickly show you how it’s conceptually done in MQL4, and next time we will go into a bit more detail.

Open MQL4 and create an empty script. Copy-paste the following code:
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
SendMail("MT4 Email Alert", "Hey there! Just letting you know that you have just "+
"made a profit on your FOREX account! Good job.");
}
//+------------------------------------------------------------------+

Now compile the script and launch it on any chart in your trading platform.

Check your email. If everything has been done according to the instructions above, you should see the following message:

metatrader 4 email alert

 

There you go! Now you know how to send an MT4 email alert from within your expert advisor, script or indicator.

 

Did you find these instructions useful? Then make sure to check out the next post where we talk about how to add useful information to your MT4 SendMail function.

Kind regards,

Kirill

What are you waiting for?

START LEARNING FOREX TODAY!

share This:
Muhammad Awais

21 Responses to “MT4 Email Alert – Setup Your MetaTrader in 4 Easy Steps”

May 11, 2015 at 12:16 pm, Eljan Mammadov said:

Thanks for useful information, I did everything step
by step but got this “mail:test message failed” in the terminal
journal. I can’t figure out what I did wrong.

Reply

February 02, 2017 at 3:37 am, jojo Samson said:

USE THIS SMTP: smtp.gmail.com: 465

THIS EXAMPLE IS WRONG WITHOUT THE PORT :465

Reply

May 15, 2017 at 10:20 am, Sandor Barnabas said:

Confirm . You shall write the port “:465”.

The correct words are smtp.gmail.com:465
Then turn ON the “Allow less secure apps” in Gmail and it will work.

Reply

May 15, 2017 at 10:18 am, Sandor Barnabas said:

You shall turn ON the option in Gmail for “Allow less secure apps”. Take a look at this screenshot : http://prntscr.com/f805ag

Reply

June 16, 2015 at 2:55 pm, Jony said:

Hi. This email option would have been fine but now that everyone has a smartphone, push notification option in MT4 is better. Simply, get MT4 app for iphone/android. Login to your trading acct. Get metaquotes ID for that downloaded app. Put that ID in MT4 notification tab & enable push notification. Start & run MT4 app. Make sure MT4 app is never shut down by task killer. As long as MT4 app runs on your phone in the background, you will get push notification.

Reply

June 18, 2015 at 3:21 am, Kirill said:

Hi Jony. Awesome setup! I’ll give it a go and perhaps put up another article with instructions. In terms of email, I still see it as a viable option since everybody is checking emails 24/7 these days. Nevertheless, a push notification would definitely be more real-time.

Reply

July 30, 2015 at 11:49 am, Vladimir said:

Just a little hint about what was written by Eljan. Yesterday I tried this option with gmail and had the same fault while using email account smtp from VPS. I have got only one successful send after pressing “test”, after that it was fault.
I came up with solution that named “go to the swimming pool”…
Problem was in gmail account that was blocked as gmail server probably have a rule that mark activity as suspicious when account is created in one place and then used in the another place. After logging in again to the new account (SMS verification was required) and unblocking the account… there was still a problem. However after going to the… swimming pool (!) for about an hour and trying after a while, MT4 was able to access smtp without any faults! Cheers

Reply

July 30, 2015 at 1:32 pm, Kirill said:

Thanks for sharing Vlaimir. Great advice to check Google security warnings if the emails are not being delivered.

Your “Swimming pool” solution totally rocks!

Cheers,
Kirill

Reply

August 30, 2015 at 2:33 pm, Disander S. Livermore said:

for the error —- Mail: ‘Test message’ failed —- try writing something in “Source” when setting up an alert. This error is not a connection problem. You email settings are perfectly fine if you are getting this error.

Reply

November 30, 2015 at 6:11 am, Mr. Indranx said:

I tried many times and failed. I follow all the steps above. It shows “Mail:error connection to smtp.gmail.com”

Reply

March 14, 2016 at 6:46 pm, Jay said:

Sorry, these instructions weren’t helpful. After following the instructions, I clicked “test” and in my Gmail I got the message: “Sign-in attempt prevented”. I don’t know why.

Also, what goes in the “SMTP password” box up above. Maybe I put the wrong password.

Reply

March 29, 2016 at 2:56 pm, Brandon Williams said:

Hi. Gmail actually has three options for sending email. I have used the restricted gmail smtp server which does not require a username or password but can only send to gmail accounts. For those of you with gmail accounts this might be easier than setting up a separate account. This is also helpful for those of you that received a “Sign-in attempt prevented” message.

https://support.google.com/a/answer/176600?hl=en

Reply

August 02, 2016 at 5:40 am, Judy Thurmond2 said:

You’ve just given me the info I was searching for. I recently had to fill out a form and spent an enormous amount of time trying to find an appropriate

Reply

October 12, 2016 at 10:39 am, Mahmoud Al kadi said:

Hi. How can I add an email option to an existing indicator that lacks it . Thankfully the mt4 can send me email alerts for indicators that have existing email alert function . Thanks !

Reply

February 02, 2017 at 3:39 am, jojo Samson said:

use this smtp server below so that send successfully to your account

smtp.gmail.com: 465

Reply

May 02, 2017 at 9:20 pm, rami fx signals said:

very informative post…thank you
how i can put this notification in real time on my website ?

Reply

May 05, 2017 at 9:26 am, Sipos said:

Hello Rami! Can you please give us more details about what you want to do? Send a notification from the mt4 to the website?

Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

What are you waiting for?

START LEARNING FOREX TODAY!

as seen on: