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.
    JasonNinjaTrader Customer Service

    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 pvincent, 06-23-2022, 12:53 PM
                    14 responses
                    238 views
                    0 likes
                    Last Post Nyman
                    by Nyman
                     
                    Started by TraderG23, 12-08-2023, 07:56 AM
                    9 responses
                    383 views
                    1 like
                    Last Post Gavini
                    by Gavini
                     
                    Started by oviejo, Today, 12:28 AM
                    0 responses
                    1 view
                    0 likes
                    Last Post oviejo
                    by oviejo
                     
                    Started by pechtri, 06-22-2023, 02:31 AM
                    10 responses
                    125 views
                    0 likes
                    Last Post Leeroy_Jenkins  
                    Started by judysamnt7, 03-13-2023, 09:11 AM
                    4 responses
                    59 views
                    0 likes
                    Last Post DynamicTest  
                    Working...
                    X