Email notification Problem
Email notification Problem
10 Jun 2015, 18:18
Hi everyone, I'm new here and completelly unexperienced to programming, so I hope you can help me.
The thing is I'm trying to build a bot which send an email when RSI levels get to overbough/oversold area with the message "buy/sell and the currency"
It's supposed to be a part of a major bot but i'm starting with first things.
So my first problem is to be able to set he email, I've followed the tutorial video for sending email notifications, the thing is I'm getting this error:
10/06/2015 16:27:36.087 | Failed to send email "Buy". System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: The operation has timed out. at System.Net.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.End(IAsyncResult result) at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncResult result) --- End of inner exception stack trace ---
I just don't know what I'm doing wrong, I've checket that firewall is off
The second problem is I don't know how to set the bot to distinguish currencies, do I have to build a different bot for each currency pair?
And the last thing is to set the bot to ONLY send 1 email for each trigger action, if the rsi is below to 30 then the bot just sends emails while the rsi is still below 30, and that is a lot of emails.
I think this things are nothing for any mid-level or even basic programmer, but I'm just trying to figure out the whole thing from 0.
Thank you :)
Replies
Bl3sS
11 Jun 2015, 14:45
( Updated at: 21 Dec 2023, 09:20 )
RE:
Spotware said:
Dear Trader,
In order to configure your E-mail settings please perform the following steps:
Go to Preferences and click the field Email Settings
Tick the Enable Email, Use authentication fields.
For gmail tick SSL.
Insert the Sercer (SMTP) and the Port of your Email provider (ex. for gmail Server (SMTP) = smtp.gmail.com , Port = 25).
Then insert the email username and password.
For gmail users only: if you use a two steps authentication, you will need to insert an application password.
WARNING: Email providers do have high level securities that may block users from accessing their accounts using third party applications. In that case users have to go through their Email settings and modify their security settings.
After configuring your E-mail settings you can send Email by triggering the Notifications using the following line:
Notifications.SendEmail("sender@email","recipient@email","email subject","text");
Thank you so much, I've done that quite a few times with different email providers, yet getting the same error. The thing is I want to know where does this timeout error come from, from the email settings? the ctrader configuration?
Thank you for your answer!
@Bl3sS
Bl3sS
11 Jun 2015, 15:36
Ok I just made It work now the problem is the step 3. I'll figure out step 2
What I'm trying to do is to send an email when rsi>70 and when rsi<30 just that simple, this is the code:
protected override void OnStart()
{
rsi = Indicators.RelativeStrengthIndex(Source, Periods);
}
protected override void OnTick()
{
if (rsi.Result.LastValue < 30)
{
Notifications.SendEmail("xxx@hotmail.com", "xxx@hotmail.com", "buy", "buy");
}
else if (rsi.Result.LastValue > 70)
{
Notifications.SendEmail("xxxx@hotmail.com", "xxxx@hotmail.com", "sell", "sell");
}
}
As I said before I'm a complete beginner, so this just keeps sending emails when trigger happens, like 10emails/sec I just want to get 1 email for each trigger action.
Thank you so much.
Btw I'd be nice to have an edit button for the forum :)
@Bl3sS
Spotware
11 Jun 2015, 14:19 ( Updated at: 21 Dec 2023, 09:20 )
Dear Trader,
In order to configure your E-mail settings please perform the following steps:
Go to Preferences and click the field Email Settings
Tick the Enable Email, Use authentication fields.
For gmail tick SSL.
Insert the Sercer (SMTP) and the Port of your Email provider (ex. for gmail Server (SMTP) = smtp.gmail.com , Port = 25).
Then insert the email username and password.
For gmail users only: if you use a two steps authentication, you will need to insert an application password.
WARNING: Email providers do have high level securities that may block users from accessing their accounts using third party applications. In that case users have to go through their Email settings and modify their security settings.
After configuring your E-mail settings you can send Email by triggering the Notifications using the following line:
@Spotware