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!
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
NinjaTrader
How to send a text message...
Collapse
X
-
How to send a text message...
...anyone know if we can send a text message to a phone when certain conditions are met through NT. This may be more of a C# question however I used to be a Java guy so I am not familiar with the nuances of C# and if there is a class available to do something like this. Thanks!Tags: None
-
Originally posted by NinjaTrader_Ray View PostI am unaware of any .NET class specific to sending text messages.
Comment
-
It's as simple as the following however for some reason System.Web.Mail is not available....hmmmmm....more research as I know very little about C# (is pretty similar to Java though).
using System.Web.Mail;
...
MailMessage mail = new MailMessage();
mail.To = "[email protected]";
mail.From = "Your Automated Trader";
mail.Subject = "";
mail.Body = "Some message!";
SmtpMail.SmtpServer = "localhost";
SmtpMail.Send(mail);
----EDIT--- The above works for .NET framework 1.1 the following works for 2.0 and up... (notice the change in the using statement too)
using System.Net.Mail;
MailMessage mail = new MailMessage();
mail.To.Add("[email protected]");
mail.From = new MailAddress("Your Automated Trader");
mail.Subject = "";
mail.Body = "blah!";
SmtpClient smtp = new SmtpClient("127.0.0.1");
smtp.Send(mail);
Last edited by fxRichard; 06-10-2008, 03:16 PM.
Comment
-
Ok this works...
Okay this is what ended up working for me using GMail...
using System.Net;
using System.Net.Mail;
MailMessage mail = new MailMessage();
mail.To.Add("[email protected]");
mail.From = new MailAddress("your return mail address");
mail.Subject = "";
mail.Body = "some message here";
SmtpClient smtp = new SmtpClient("smtp.gmail.com",587);
smtp.EnableSsl = true;
smtp.Credentials = new NetworkCredential("username","password");
smtp.Send(mail);
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by GLFX005, Today, 03:23 AM
|
0 responses
1 view
0 likes
|
Last Post
by GLFX005
Today, 03:23 AM
|
||
Started by XXtrader, Yesterday, 11:30 PM
|
2 responses
11 views
0 likes
|
Last Post
by XXtrader
Today, 03:07 AM
|
||
Started by Waxavi, Today, 02:10 AM
|
0 responses
6 views
0 likes
|
Last Post
by Waxavi
Today, 02:10 AM
|
||
Started by TradeForge, Today, 02:09 AM
|
0 responses
14 views
0 likes
|
Last Post
by TradeForge
Today, 02:09 AM
|
||
Started by Waxavi, Today, 02:00 AM
|
0 responses
3 views
0 likes
|
Last Post
by Waxavi
Today, 02:00 AM
|
Comment