Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NinjaTrader.Core.Globals.SendMail

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

    NinjaTrader.Core.Globals.SendMail

    In SendMail, how do I correctly format my attachmentPaths variable?

    When I try -

    NinjaTrader.Core.Globals.SendMail("[email protected]" , "[email protected]", messageTitle, messageBody, "C:\Users\MBPtrader\Pictures\EURUSD");

    I get -

    error unregognized escape sequence

    Do you have documentation on this somewhere?

    Thanks

    Westsider
    Last edited by westsider; 06-28-2017, 11:09 AM.

    #2
    Hello westsider,

    Thanks for opening the thread.

    There is an overload for SendMail() that is in the help guide, but the overload that you have mentioned is not documented and is thus an unsupported method. I will not be able to provide you any direction or instruction for its usage.

    Supported SendMail() - http://ninjatrader.com/support/helpG...s/sendmail.htm

    The compiler is throwing an error for having a "\" character in the string for your path. Additionaly, it looks like this method is expecting an array of strings, not just a string by itself.

    I was also unable to find any NinjaScripts that use this method that can be used for reference.

    Even though we may not support some methods as they may be subject to change, we encourage discussions among our users on using these methods.

    Please let me know if you have any questions.

    Comment


      #3
      Originally posted by westsider View Post
      In SendMail, how do I correctly format my attachmentPaths variable?

      When I try -

      NinjaTrader.Core.Globals.SendMail("[email protected]" , "[email protected]", messageTitle, messageBody, "C:\Users\MBPtrader\Pictures\EURUSD");

      I get -

      error unregognized escape sequence

      Do you have documentation on this somewhere?

      Thanks

      Westsider
      1. Your syntax appears to be defective, as the attachmentPaths parameter should be an array of strings, not a string.
      2. You need to properly escape characters using quoted or @-quoted forms of string.

      ref: https://msdn.microsoft.com/en-us/lib...(v=vs.71).aspx

      Comment


        #4
        Thank you

        Thanks @koganam and @NinjaTrader_Jim. I'm updating my NT7 indicators and new to NT8. I found this new reference to share(). Looks like Share Services is the way to send mail now.

        Code:
        Share(string serviceName, string message)
        Share(string serviceName, string message, object[] args)
        Share(string serviceName, string message, string screenshotPath)
        Share(string serviceName, string message, string screenshotPath, object[] args)
        when I use the above recommended syntax I get an error: parameter address cannot be empty
        Code:
        Share("Hotmail", messageBody, @"C:\Users\MBPtrader\Pictures\EURUSD.PNG");
        when using this I get an email but no attachment
        Code:
        Share("Hotmail", messageBody, new object[]{ "[email protected]", messageTitle, @"C:\Users\MBPtrader\Pictures\EURUSD.PNG"});
        Any thoughts on the proper way to send an email message with an attachment is greatly appreciated.
        Sincerely,
        Westsider

        Comment


          #5
          Hello westsider,

          Thanks for the reply.

          I would suggest to reference these methods in the help guide so you can find more information on the supported syntax and context.

          Share() is documented here: https://ninjatrader.com/support/help...re_service.htm

          From the help guide:
          Tips:
          1. The "args" parameter differs for each share service used. If you are using a custom developed share adapter, you need to work with the developer of that adapter to understand what the "args" parameter represents for that adapter.
          2. For the default NinjaTrader share adapters, the "args" array represents the following:

          ▪ Mail share service:
          • args[0] = A string representing the email "To" field,
          • args[1] = A string representing the email "Subject" field

          ▪ StockTwits share service:
          • args[0] = An enum representing the "StockTwitsSentiment" parameter
          As the help guide states, using Share() to send an email will expect the object array to represent the To and Subject field of an email.

          If you would like I could submit a feature request on your behalf for allowing attachments to be sent from a Share() or SendMail() call.

          Please let me know if I may be of further assistance.

          Comment


            #6
            Feature request

            Hi Jim,
            Yes a feature request to allow image sharing over email would be greatly appreciated.
            Thanks so much!
            Westsider

            Comment


              #7
              Hello westsider,

              I have received word back on the feature request.

              It is being tracked with ticket ID SFT-2475 and can be found in the release notes of the version of NinjaTrader 8 that includes this feature.

              Release Notes - https://ninjatrader.com/support/help...ease_notes.htm

              Keep in mind it is up to the development team and their priorities to fulfill a feature request.

              Thanks for providing your input!

              Comment


                #8
                Thanks for the update!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                598 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                343 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                103 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                557 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                555 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X