Topics
Replies

ashtwentythree
15 Mar 2024, 13:10 ( Updated at: 16 Mar 2024, 10:58 )

RE: RE: Email notifications

ashtwentythree said: 

PanagiotisCharalampous said: 

Hi there,

Have you set your access rights to Full Access?

Best regards,

Panagiotis

Hi Panagiotis,

Yea, I have. It's been set to that for a while.

Just to give an update on this, in case anyone else has the issue. 

I went back to using Gmail and created an App Password. I used that instead of my own password and it worked right away. phew

Go here for more info on App Passwords

Sign in with app passwords - Google Account Help

 


@ashtwentythree

ashtwentythree
20 Feb 2024, 11:59

RE: Email notifications

PanagiotisCharalampous said: 

Hi there,

Have you set your access rights to Full Access?

Best regards,

Panagiotis

Hi Panagiotis,

Yea, I have. It's been set to that for a while.


@ashtwentythree

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

ashtwentythree
15 Aug 2023, 09:52 ( Updated at: 15 Aug 2023, 09:56 )

For anyone that's having issues with the latest ctrader 4.8, I found the previous version (4.7.13) in this directory:

C:\Users\*Your username*\AppData\Local\Spotware\cTrader\4282ac50e6a21025db1b7336688d89c6

It's fixed my above issue, hope it helps someone else.


@ashtwentythree