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

Sending email from inside a script.

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

    Sending email from inside a script.

    Hi

    I wanted to develope an indicator that has an email function. Using System.Net.Mail, with the following code:-

    Code:
    MailMessage mail1 = new MailMessage("[email protected]", "[email protected]");
    			SmtpClient client1 = new SmtpClient();
    			client1.Port = 465;
    			client1.Credentials = new System.Net.NetworkCredential("[email protected]","1234");
    			client1.DeliveryMethod = SmtpDeliveryMethod.Network;
    			client1.UseDefaultCredentials = false;
    			client1.Host = "smtp.email.com";
    			client1.EnableSsl = true;
    			
    			mail1.Subject = "this is a test email 12345.";
    			mail1.Body = "this is my test email body 12345";
    			client1.Send(mail1);
    But when I use this NT freezes up, is there a reason for this, is it not a good idea to try and do this?

    #2
    GKonheiser, how often / when would you trigger the sending? I would just recommend to use our default SendMail() NinjaScript methd for this task.

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bertrand,

      OK I will use the built in method. I am having a problem with one of my installations of NT and sending a test email. On one machine test email is sent without a problem, on my second install I cant get a test email to be sent. Always getting timeouts. I've tried two different accounts. Is there a way to debug this from a more detailed log?

      Comment


        #4
        GKonheiser, if this is isolated for both accounts to a specific machine, I would first check into the firewall setup here and compare. A first quick test would be just deactivating all filtering rules and recheck.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          It was the stupid windows firewall : ). Thanks

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by burtoninlondon, Today, 12:38 AM
          0 responses
          9 views
          0 likes
          Last Post burtoninlondon  
          Started by AaronKoRn, Yesterday, 09:49 PM
          0 responses
          14 views
          0 likes
          Last Post AaronKoRn  
          Started by carnitron, Yesterday, 08:42 PM
          0 responses
          11 views
          0 likes
          Last Post carnitron  
          Started by strategist007, Yesterday, 07:51 PM
          0 responses
          13 views
          0 likes
          Last Post strategist007  
          Started by StockTrader88, 03-06-2021, 08:58 AM
          44 responses
          3,983 views
          3 likes
          Last Post jhudas88  
          Working...
          X