Email Notifications not working

Created at 22 Dec 2020, 20:30
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!
JA

jackhpfilerrowson

Joined 26.11.2020

Email Notifications not working
22 Dec 2020, 20:30


Hi, can anyone help get this working? The following code comes up with the following error in the log


22/12/2020 18:21:17.062 | Failed to send email "Trade Potential (Buy)". System.Net.Mail.SmtpException: The SMTP host was not found. ---> System.Net.WebException: The remote name could not be resolved: 'smpt.gmail.com'    at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6)    at System.Net.PooledStream.Activate(Object owningObject, Boolean async, GeneralAsyncDelegate asyncCallback)    at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout)    at System.Net.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.GetConnection(Boolean synchronous)    at System.Net.Mail.SmtpConnection.BeginGetConnection(ServicePoint servicePoint, ContextAwareResult outerResult, AsyncCallback callback, Object state)    at System.Net.Mail.SmtpTransport.BeginGetConnection(ServicePoint servicePoint, ContextAwareResult outerResult, AsyncCallback callback, Object state)    --- End of inner exception stack trace ---    at System.Net.Mail.SmtpTransport.BeginGetConnection(ServicePoint servicePoint, ContextAwareResult outerResult, AsyncCallback callback, Object state)    at System.Net.Mail.SmtpClient.SendAsync(MailMessage message, Object userToken)    at A.JT.Send(Email email) in File1769:line 87
 

 

using System;
using System.Linq;
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 AdxRsiHma : Robot
    {
        private ExponentialMovingAverage Ema;
        private ExponentialMovingAverage Ema2;

        protected override void OnStart()
        {
            Ema = Indicators.ExponentialMovingAverage(Bars.ClosePrices, 8);
            Ema2 = Indicators.ExponentialMovingAverage(Bars.ClosePrices, 2);
        }

        protected override void OnTick()
        {
            if (Ema2.Result.LastValue < Ema.Result.LastValue || Ema2.Result.LastValue > Ema.Result.LastValue)
            {

                Notifications.SendEmail("jackhpfilerrowson@gmail.com", "ctradernotifications@gmail.com", "Trade Potential (Buy)", "Check Account");

            }
        }

    }
}

 

 


@jackhpfilerrowson
Replies

PanagiotisCharalampous
23 Dec 2020, 08:13

Hi jackhpfilerrowson,

Try smtp instead of smpt.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

jackhpfilerrowson
23 Dec 2020, 18:27

RE:

PanagiotisCharalampous said:

Hi jackhpfilerrowson,

Try smtp instead of smpt.

Best Regards,

Panagiotis 

Join us on Telegram

Hi Panagiotis

I just tried that and its still saying its failed to send an email in the log.

Thanks for your time,

Jack


@jackhpfilerrowson

PanagiotisCharalampous
24 Dec 2020, 07:47

Hi Jack,

Check this article as well.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous