Cone8
 ( 6.32% )
- ago
Could be two-fold:

1. Built-in WL6-like feature
2. Code-based AlertByEmail analogue as a WealthScript method for sending customized alerts by email
13
2,051
19 Replies

Reply

Bookmark

Sort
kazuna8
 ( 34.34% )
- ago
#1
My WL6.9 strategy code heavily relies on AlertByEmail.
Please consider support AlertByEmail equivalent API in WL7.
0
- ago
#2
The source code is open, you can simply add it to your own method library:
http://www2.wealth-lab.com/WL5WIKI/CommunityComponentsMain.ashx
0
kazuna8
 ( 34.34% )
- ago
#3
CODE:
WealthLab.InternetEx.SendEmail(new WealthLab.EmailAlertParams(From, smtpServer, Port, _login, Pass, secure), To, Subj, Msg);

WL7's WealthLab class doesn't seem exporting InternetEx class, thus there is no SendEmail?
0
- ago
#4
It's a so called extension method so it's not the WealthLab class that exposes the IntenetEx class. This is just syntactic sugar. Please read the Wiki link above, it has a pointer which explains extension methods. You'll find the class with the method in /ExtensionMethods folder of the solution (log in to the Wiki to get attachments).
0
- ago
#5
As this request has reached Top-5, let me see if I can expose it as WealthScript method for Build 12 (i.e. #2) while leaving #1 (GUI feature) for Dion to decide.
0
kazuna8
 ( 34.34% )
- ago
#6
Ahh, I found it in InternetEx.cs.
Because it is named as WealthLab, I thought it is the same WealthLab class and so I didn't search the code in the souce.
0
- ago
#7
Added SendEmail for Build 12:
CODE:
public void SendEmail(string fromEmail, string smtpServer, string login, string password, int smtpPort, string toEmail, string messageSubject, string messageText, bool smtpEnableSSL = true)
1
- ago
#8
Is this feature supported in WL8? I've not been able to get to work using sample code from QuickRef. No error message. Just no evidence of sending mail from mail server. Are there any special "using" settings?
0
- ago
#9
Most likely has to do with Gmail's takedown of "Allow less secure apps to access your account". Here's a hint for your own research:
https://stackoverflow.com/questions/73365098/how-to-turn-on-less-secure-app-access-on-google

As other providers follow you can experiment with whatever options remain and configure as required. I'm not using this.
0
- ago
#10
Thanks for that info, Eugene. I wasn't aware of that.

I tried with my ISP's webmail settings but wasn't able to get it to work. Not sure how to troubleshoot. Try-Catch doesn't show anything.

Do you spot anything amiss with this line of code
CODE:
               SendEmail("mentor@domain.com", "mail.domain.com", "mentor@domain.com", "[emailPassword]", port, "mentor@domain.com", "Hello World from Wealth-Lab 8", t.Description, true);


I insert a real domain in place of "domain"
0
arflouro828
 ( 7.31% )
- ago
#11
finantic.Publisher already sends them via email to potential subscribers or to yourself.
0
- ago
#12
I created a new outlook.com email address to serve this purpose, and it works to send out email from WL8.

Here's some sample code:
CODE:
//insert where you want to write your email alert in body of code string messageSubject = "messagesubjecttext"; string messageText = bars.Symbol + " messagetext"; SendEmail(fromemail, smtpserver, login, emailpw, smtpPort, toEmail, messageSubject, messageText, true); //declare private variables below //email settings string fromemail = "yournewemail@outlook.com"; string smtpserver = "smtp-mail.outlook.com"; string login = "yournewemail@outlook.com"; string emailpw = "yourpw"; int smtpPort = 587; string toEmail = "whereyouwanttosendit@gmail.com";
1
- ago
#13
To Post #18: check antivirus/firewall rules.
0
- ago
#14
@bcdxxxx Thank you very much for testing this for me and sharing! I was able to get it working with my Outlook account. The issue was that this WL method does not appear to support SSL (port 465) unless you found a way to get that working.
1
- ago
#15
@innertrader,
Sorry, I didn't try getting it to work with SSL/port 465. I figured nothing was at all super-secret that I wanted to email myself on trading signals that I needed SSL. I was just happy enough to get it to send an email after generating a signal (after failing to get it to work with Gmail).
0
- ago
#16
I'm using the code in the QuickRef help section. I've tried multiple email systems, confirmed the smtp servers, and tried both ports and I'm still not getting any messages. I've heard there can be issues with certain email providers; are they any out there that have been confirmed to work?

CODE:
      //execute the strategy rules here, this is executed once for each bar in the backtest history       public override void Execute(BarHistory bars, int idx)       {                    if(idx == bars.Count - 1)          {             Transaction t = PlaceTrade(bars, TransactionType.Buy, OrderType.Market);             // for Gmail, port can be 587 (TLS) or 465 (SSL)             int port = 465;             SendEmail("xxx@comcast.net", "smtp.comcast.net", "yyy@comcast.net", "xxxxxxxxx", 465, "pmerges@live.com", "Hello World from Wealth-Lab 8", t.Description);          }       }       //declare private variables below
0
- ago
#17
Yes, Post #14 (of this thread where I merged your topic with) points out that your selected SMTP port supposedly won't work.
0
- ago
#18
I posted this separately, but just for consistency I'll add it here.

Gmail and Outlook no longer support the SMTP protocol. You will need to find an email provider that still offers this in order to make it work. I found one (runbox.com) that was easy to set up and not expensive but there are others.
0
- ago
#19
Re: Post #18. Unless you're talking about something Outlook specific (never used it), I'm pretty sure SMTP keeps working for my bots in Gmail if set properly (OAuth2, app passwords, etc.)
0

Reply

Bookmark

Sort