Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can't Send Mail

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

    Can't Send Mail

    Hi,

    I'm using the "Testmail" function under the Misc. tab, and when attempting to send an email I get the following Error:

    Failed to send email: Error connecting to server. 81.169.163.72





    I've left the SMTP field blank for default.

    #2
    Somehow NinjaTrader could not send the email, since it could not connect to the server. Please check for software, such as (corporate) firewalls, pop up blockers and anti-virus software, that could be blocking the connection.

    Comment


      #3
      I don't have any of those things operating.

      I don't know if this is relevant but when I type that IP address into my browser it can't connect either...

      Comment


        #4
        Hello,

        Please input your ISP's SMTP server information. If you do not know this information please contact your ISP and ask them.
        DenNinjaTrader Customer Service

        Comment


          #5
          Ok, I tried that, and no luck either.

          I'm receiving the error:

          Failed to send mail:503 #5.3.3 AUTH not available

          Comment


            #6
            This is an error in getting authentication for your SMTP use. Please ensure you have SMTP information from your ISP along with the proper credentials to use it. You would put these inside the Tools->Options->Misc tab.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Hey,

              I had a similar problem with my ISP and they're email. The solution I found is to code up my own Email function within NinjaScript.

              You have to add this to the "Using" at the top of your code.
              Code:
              using System.Net.Mail;
              Then this is the function
              Code:
                      public int SendMailLocal(String iToAddress, String iFromAddress, String iSubject, String iBody, String iSMTPClient, String iPort)
                      {
                          try
                          {
                              // To
                              MailMessage mailMsg = new MailMessage();
                              mailMsg.To.Add(iToAddress);
              
                              // From
                              MailAddress mailAddress = new MailAddress(iFromAddress);
                              mailMsg.From = mailAddress;
              
                              // Subject and Body
                              mailMsg.Subject = iSubject;
                              mailMsg.Body    = iBody;
              
                              // Init SmtpClient and send
                              SmtpClient smtpClient = new SmtpClient(iSMTPClient, Convert.ToInt32(iPort));
                              System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(iPort, iPort);
                              smtpClient.Credentials = credentials;
              
                              smtpClient.Send(mailMsg);
                              return 1;
                          }
                          catch (Exception ex)
                          {
                              Print(ex.Message.ToString());
                              return -1;
                          }
              An example function call is
              Code:
              int sendMailVerify = SendMailLocal("[email protected]", "[email protected]", "Test Subject", "Some test message", "mail.optonline.net", "25");
              Let me know if you have any trouble.

              mrLogik
              mrlogik
              NinjaTrader Ecosystem Vendor - Purelogik Trading

              Comment


                #8
                Hey thanks Mrlogic,

                However I already did a bit of a workaround of my own by using a service called "authsmtp" which is an smtp mail relay service. It's working well, (for a small fee of course).

                But thanks a lot for your suggestion, and let's hope it helps some others out here. I know when I searched there were a few cases of this problem without any fixes it seemed.

                Cheers!

                Comment


                  #9
                  My solution won't cost anything if you get tired of using authsmtp :-)

                  have a nice day
                  mrlogik
                  NinjaTrader Ecosystem Vendor - Purelogik Trading

                  Comment


                    #10
                    Hi.
                    I tried your code but I can´t get it to work. I´m no "coder" so I made a strategy using wizzard. Then I tried to insert your code but couldn´t get it to work. The "using"-part I put in the begining of the script and the code in the end and last I put the "int sendMailVerify = SendMailLocal... ". Is this correct?

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by argusthome, 03-08-2026, 10:06 AM
                    0 responses
                    93 views
                    0 likes
                    Last Post argusthome  
                    Started by NabilKhattabi, 03-06-2026, 11:18 AM
                    0 responses
                    48 views
                    0 likes
                    Last Post NabilKhattabi  
                    Started by Deep42, 03-06-2026, 12:28 AM
                    0 responses
                    31 views
                    0 likes
                    Last Post Deep42
                    by Deep42
                     
                    Started by TheRealMorford, 03-05-2026, 06:15 PM
                    0 responses
                    34 views
                    0 likes
                    Last Post TheRealMorford  
                    Started by Mindset, 02-28-2026, 06:16 AM
                    0 responses
                    70 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Working...
                    X