How enable send email notification for cloud instance

Created at 11 Aug 2024, 10:22
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
JI

jiri.work

Joined 11.08.2024

How enable send email notification for cloud instance
11 Aug 2024, 10:22


Hello,

In my algo trading bot, I have an information email set to be sent at the end of the call to the onBarClose() method. When running locally, everything works as it should, but if I run the instance in the cloud, the email is not sent.

How enable send email notification for cloud instance?

Thank you

Code example

		protected override void OnBarClosed()
        {
            // ...
            
            SendEmail();
         }
         
        private void SendEmail()
        {
            string from = "my-email@email.com";
            string to = Email;
            string subject = $"Strategy {this.GetType().Name}: {this.TimeFrame.ShortName} {Symbol.Name} - successful call onBar";
            string text = "";
            Notifications.SendEmail(from,to,subject,text);
        }

Log local environment

11/08/2024 10:11:15.340 | Info | CBot instance [TurtleTrendFollow_cBot, BTCUSD, D1] started.
11/08/2024 10:11:16.403 | Info | Email "Strategy TurtleTrendFollow_cBot: D1 BTCUSD - successful call onBar" was sent to "my-email@email.com"

Log cloud environment

11/08/2024 10:11:44.044 Info | CBot instance [c56442be-4b62-4f5b-9063-56ae9da69233, BTCUSD, D1] started.
11/08/2024 10:11:45.748 Info | Email "Strategy TurtleTrendFollow_cBot: D1 BTCUSD- successful call onBar" was not sent because email notifications are disabled

@jiri.work
Replies

firemyst
13 Aug 2024, 00:01

You can't.

Emails aren't allowed to be sent from bots running in the cloud.

 


@firemyst