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 andrewtrades, Today, 04:57 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by chbruno, Today, 04:10 PM
          0 responses
          6 views
          0 likes
          Last Post chbruno
          by chbruno
           
          Started by josh18955, 03-25-2023, 11:16 AM
          6 responses
          436 views
          0 likes
          Last Post Delerium  
          Started by FAQtrader, Today, 03:35 PM
          0 responses
          7 views
          0 likes
          Last Post FAQtrader  
          Started by rocketman7, Today, 09:41 AM
          5 responses
          19 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X