Email notification not working in 4.3.8

Created at 08 Jul 2022, 11:34
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!
Capt.Z-Fort.Builder's avatar

Capt.Z-Fort.Builder

Joined 03.06.2020

Email notification not working in 4.3.8
08 Jul 2022, 11:34


Hello, I have tested the new 4.3.8 cross-broker version. I had a few problems, the first one is indicator/Bots not sending an email notification anymore. 

Put the exact setting as 4.1 version(ICMarket), whether the bots compiled by 4.3.8 or 4.1  the old version has no problem sending email notifications by the below coding. While 4.3.8 has no successful result after several tries.

Please advise if there is anything else I could try?

Thanks

P.S. I have made a Clean Installation on ver 4.3.8 and uninstalled all .Net FrameWork components and reinstalled the newest both SDK(6.0.301) and Runtime(6.0.6). But the problem is still same there.

using System;
using System.Linq;
using System.Globalization;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class BotTest : Robot

    {
        protected override void OnStart()
        {
            //Test EmailNotification
            TestEmailNotification();
        }

        protected override void OnTick() {}
        protected override void OnStop() {}

        //Test EmailNotification
        private void TestEmailNotification()
        {
            string ver = "4.3.8.6352"; //4.1.17 ; 4.3.8.6352
            string sSubject = "Sub: " + ver;
            string sMessage = "Msg: " + ver;
            Notifications.SendEmail("xxx@mail.com", "xxx@mail.com", sSubject, sMessage);
            Chart.DrawStaticText("ChTx", sMessage, VerticalAlignment.Top, HorizontalAlignment.Center, Color.FromHex("#88AABBFF"));
        }

    }
}

 


@Capt.Z-Fort.Builder
Replies

PanagiotisCharalampous
15 Jul 2022, 11:52

Hi TheNiatpac,

Do you get any exceptions in the log when the email is sent? Can you provide screenshots of the log?

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous

Capt.Z-Fort.Builder
15 Jul 2022, 12:00 ( Updated at: 21 Dec 2023, 09:22 )

RE:

I hope I get the screen you need below: BTW, it's compiled in Target Framework 6.0

PanagiotisCharalampous said:

Hi TheNiatpac,

Do you get any exceptions in the log when the email is sent? Can you provide screenshots of the log?

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

 


@Capt.Z-Fort.Builder

PanagiotisCharalampous
15 Jul 2022, 12:09

Hi TheNiatpac,

So can you confirm that there are no exceptions in the log?

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous

Capt.Z-Fort.Builder
15 Jul 2022, 12:10

RE:

Sorry, I don't really understand what is 'exceptions in the log', please advise.

PanagiotisCharalampous said:

Hi TheNiatpac,

So can you confirm that there are no exceptions in the log?

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

 


@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
15 Jul 2022, 12:40 ( Updated at: 21 Dec 2023, 09:22 )

RE:

Do you mean the similar coding in the screen chop? But nothing special after I run it.

PanagiotisCharalampous said:

Hi TheNiatpac,

So can you confirm that there are no exceptions in the log?

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

 


@Capt.Z-Fort.Builder

Capt.Z-Fort.Builder
20 Jul 2022, 14:51 ( Updated at: 21 Dec 2023, 09:22 )

This issue has been fixed in 4.3.9.7083

Thank you Spotware and all cTrader developers. :)


@Capt.Z-Fort.Builder

ashtwentythree
12 Feb 2024, 23:46

Email notifications

I'm not sure if I should create a new post or continue this one, but I've never been able to get email notifications working. I've tried using the email settings in ctrader and also creating a smtp client in c#.

I've tried my outlook, icloud, gmail and created a new yahoo account, using their email addresses and smtp server names. I tried both the 465 and 587 ports and I always get ‘Authentication with SMTP server failed’ or ‘GeneralFailure’ status code in c# and ‘Failure sending mail’.

My code with current yahoo server code and user/pass removed below. Any help would be appreciated.

    try
    {
        Print("C# - Attempting to email...");

        var smtpClient = new SmtpClient() 
        {
            Host = "smtp.mail.yahoo.com", // smtp-mail.outlook.com. smtp.office365.com
            Port = 465, // 465 / 587
            EnableSsl = true,
            DeliveryMethod = SmtpDeliveryMethod.Network,
            UseDefaultCredentials = false,
            Credentials = new NetworkCredential("***", "***")
        };
                
        var mailMessage = new MailMessage
        {
            From = new MailAddress(EmailAddressFrom),
            Subject = "Hello from Bot",
            Body = "Hello, this is a test email from C#."
        };

        mailMessage.To.Add(EmailAddressTo);

        smtpClient.Send(mailMessage);
        smtpClient.SendCompleted += SendCompleted;

    }
    catch (SmtpException ex)
    {
        throw new ApplicationException
        ($"C# - SmtpException has occured. Status code: {ex.StatusCode}. Msg: {ex.Message}" );
    }

@ashtwentythree