Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

SendMail not working as Text message via email

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    SendMail not working as Text message via email

    Hello.

    I'm trying to create a strategy that will send me a text message alert via email. Unfortunately, the SendMail() function does not seem to be working.

    I have the following code:
    if (cond1)
    {
    Print("RBuD ("+Convert.ToString(Time[0])+")");
    SendMail("9********[email protected]", "RBuD ("+Convert.ToString(Time[0])+")", "RBuD");
    }

    When backtesting in the Strategy Analyzer, the print statement works as expected when cond1 is True but the SendMail function doesn't. I also tried SendMail() with a gmail address but it still seems to not work for a regular gmail address or for a text message via email.

    Can anyone help troubleshoot this issue?

    Thanks.

    #2
    Hello rcloutier, thanks for writing in.

    You must set up a Share Service in the options menu to act as the mail server. See here for documentation:

    https://ninjatrader.com/support/help...gShareServices

    Below is a list of common setups for SMTP servers:

    https://ninjatrader.com/support/foru...setups?t=45339

    Please let me know if this does not resolve your inquiry.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi NinjaTrader_ChrisL.

      I confirm that I already have both share services configured. That is clearly not the issue.

      Comment


        #4
        Hello rcloutier, thanks for your reply.

        Are you able to send a text message to this address through a normal email address? The SendMail() method will work if the share service is set up properly. If you can not send a message to a normal email address using SendMail, it implies the share service was not set up correctly. Please try sending a message to a regular email address and test if that works. If not, make sure the share service is set up properly.

        Please let me know if I can assist any further.

        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Hi NinjaTrader_ChrisL.

          Yes, if I send an email from my gmail account to the address ending in @txt.att.net, I receive a text message as expected.

          The regular email share service is setup correctly. I know this because from the setup window on NT8, I clicked on "Send e-mail test" and I received that test email as expected.

          The text message via email share service is also setup correctly. I know this because from my chart, I setup a text message alert that I did receive.

          Everything appears to be working properly except when I try to use the SendMail() function directly from a custom strategy.

          Comment


            #6
            Hello rcloutier, thanks for your reply.

            Can you test out this indicator that I made in the past? It will email the specified email address when an execution occurs on the account:

            https://ninjatraderecosystem.com/use.../email-trades/

            I look forward to hearing of your results.

            The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by rcloutier View Post
              create a strategy that will send me a text message alert via email.

              When backtesting in the Strategy Analyzer, ... the SendMail function doesn't work.
              SendMail only works when State == State.RealTime,


              Since Strategy Analyzer uses Historical data only,
              calls to SendMail are ignored while backtesting.

              Comment


                #8
                I actually found the issue with trying to send a text message via email is that the SendMail() function is not what I should have been using. Neither live nor in the strategy analyzer.

                Instead, what I found to work was to first set up the "Text message via email", and then in my strategy to use the Share() function with the first argument set to @"Text message via email". For me, this works as expected.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by bortz, 11-06-2023, 08:04 AM
                47 responses
                1,609 views
                0 likes
                Last Post aligator  
                Started by jaybedreamin, Today, 05:56 PM
                0 responses
                9 views
                0 likes
                Last Post jaybedreamin  
                Started by DJ888, 04-16-2024, 06:09 PM
                6 responses
                19 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by Jon17, Today, 04:33 PM
                0 responses
                6 views
                0 likes
                Last Post Jon17
                by Jon17
                 
                Started by Javierw.ok, Today, 04:12 PM
                0 responses
                16 views
                0 likes
                Last Post Javierw.ok  
                Working...
                X