|
Remote run: sendEmail(...) |
Moggy
|
Post subject: how to grant socket permission in remote mode? |
Post rating: 0
|
Posted: Thu 24 Apr, 2014, 08:41
|
|
User rating: 1
Joined: Tue 27 Aug, 2013, 17:39 Posts: 26 Location: China, Shanghai
|
Dears: i have write a strategy to send mail in remote mode,but failed,the log is: Exception:java.security.AccessControlException: access denied ("java.net.SocketPermission" "smtp.163.com" "resolve") i add the following grant clause to java.policy,but the problem still exist. permission java.net.SocketPermission "*", "accept,connect,resolve"; anybody can help me? thanks a lot
btw: local mode is OK
|
|
|
|
|
hebasto
|
Post subject: Re: how to grant socket permission in remote mode? |
Post rating: 1
|
Posted: Thu 24 Apr, 2014, 09:04
|
|
User rating: 96
Joined: Mon 09 Sep, 2013, 07:09 Posts: 287 Location: Ukraine, SHostka
|
|
|
|
|
Moggy
|
Post subject: Re: how to grant socket permission in remote mode? |
Post rating: 1
|
Posted: Fri 25 Apr, 2014, 04:08
|
|
User rating: 1
Joined: Tue 27 Aug, 2013, 17:39 Posts: 26 Location: China, Shanghai
|
hebasto wrote: thanks for your kindly reply. i have read this topic before. quotation: @Library("mail-1.4.jar") jar location: mail-1.4.jar is located in /home/moggy/JForex/Strategies/files/ (my OS is Ubuntu) add the permission in both files: /etc/java-6-sun/security/java.policy /etc/java-6-openjdk/security/java.policy // Allow connection to mail server using SMTP permission java.net.SocketPermission "*:25", "connect,resolve"; // Allow connection to mail server using SMTPS permission java.net.SocketPermission "*:465", "connect,resolve";
permission java.net.SocketPermission "*:994", "connect,resolve";
// Allow connection to mail server using IMAP permission java.net.SocketPermission "*:143", "connect,resolve"; // Allow connection to mail server using IMAPS permission java.net.SocketPermission "*:993", "connect,resolve";
// Allow connection to mail server using POP3 permission java.net.SocketPermission "*:110", "connect,resolve"; // Allow connection to mail server using POP3S permission java.net.SocketPermission "*:995", "connect,resolve";
sendMail Function: public boolean sendMail(String from, String to, String subj, String text) throws Exception { Properties props = new Properties(); props.put("mail.smtp.host", smtpServer); props.put("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.port", "465"); props.put("mail.smtp.auth", "true"); Session session = Session.getDefaultInstance(props, new MailAuth( sendermailadd, senderpassword)); Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress(from)); msg.setRecipients(RecipientType.TO, InternetAddress.parse(to, false)); msg.setSubject(subj); msg.setText(text); Transport.send(msg); return true; }
|
|
|
|
|
hebasto
|
Post subject: Re: how to grant socket permission in remote mode? |
Post rating: 2
|
Posted: Fri 25 Apr, 2014, 07:48
|
|
User rating: 96
Joined: Mon 09 Sep, 2013, 07:09 Posts: 287 Location: Ukraine, SHostka
|
I've searched through this forum and find out ( Sending an email) that one should use RequiresFullAccess annotation to be allowed send email. BUT RequiresFullAccess annotation is not allowed in remote strategy code ( Remote Run) In my opinion remote strategy environment is not suitable for such tasks as sending email. And it is not reliable as well ( Delay in data feed on Remote Run).
|
|
|
|
|
Moggy
|
Post subject: Re: how to grant socket permission in remote mode? |
Post rating: 0
|
Posted: Fri 25 Apr, 2014, 09:50
|
|
User rating: 1
Joined: Tue 27 Aug, 2013, 17:39 Posts: 26 Location: China, Shanghai
|
hebasto wrote: I've searched through this forum and find out ( Sending an email) that one should use RequiresFullAccess annotation to be allowed send email. BUT RequiresFullAccess annotation is not allowed in remote strategy code ( Remote Run) In my opinion remote strategy environment is not suitable for such tasks as sending email. And it is not reliable as well ( Delay in data feed on Remote Run). Yeah,exactly,maybe it's commercial but not technical reason.
|
|
|
|
|
API Support
|
Post subject: Re: how to grant socket permission in remote mode? |
Post rating: 0
|
Posted: Mon 28 Apr, 2014, 09:12
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
We plan to add mail sending functionality to API in order to facilitate the mail sending routine and enable its usage in the local run. Meanwhile consider broadcasting your message to a local strategy, which thereafter would send the e-mail: https://www.dukascopy.com/wiki/#Broadcast_message
|
|
|
|
|
whiletrue
|
Post subject: Remote run: log and alert |
Post rating: 0
|
Posted: Wed 11 Jun, 2014, 14:45
|
|
User rating: 0
Joined: Fri 17 May, 2013, 06:58 Posts: 76 Location: SwedenSweden
|
Hi,
When doing Remote run on a strategy, what is the preferred way to: - log (i.e., log to file or console so that I can look and/or retreive the log at any time in the future)? Also, are there any limitations on the log size? - alert myself (e.g., sending myself an e-mail) when something goes wrong?
Thanks.
Regards, Henrik
|
|
|
|
|
hebasto
|
Post subject: Re: Remote run: log and alert |
Post rating: 2
|
Posted: Wed 11 Jun, 2014, 19:35
|
|
User rating: 96
Joined: Mon 09 Sep, 2013, 07:09 Posts: 287 Location: Ukraine, SHostka
|
|
|
|
|
whiletrue
|
Post subject: Re: Remote run: log and alert |
Post rating: 0
|
Posted: Thu 12 Jun, 2014, 11:39
|
|
User rating: 0
Joined: Fri 17 May, 2013, 06:58 Posts: 76 Location: SwedenSweden
|
Hi again,
Thanks hebasto.
Does Dukascopy provide a smtp server, or do I have to provide one myself? If so, can I use my gmail stmp server? If so, how?
Regards, Henrik
|
|
|
|
|
API Support
|
Post subject: Re: Remote run: log and alert |
Post rating: 0
|
Posted: Thu 12 Jun, 2014, 11:53
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
|
Moggy
|
Post subject: Re: how to grant socket permission in remote mode? |
Post rating: 0
|
Posted: Fri 13 Jun, 2014, 04:18
|
|
User rating: 1
Joined: Tue 27 Aug, 2013, 17:39 Posts: 26 Location: China, Shanghai
|
the new JDK have add an interface JFUtils.sendEmail to send mail in remote mode. https://www.dukascopy.com/wiki/#Send_e-mailit seems that jdk use mail-1.4.jar too~ Now the problem is,when i call myutils.sendMail(smtpServer, from, to, subj, text); it shows exception: 06:19:11 Exception:com.dukascopy.api.JFException: com.sun.mail.smtp.SMTPSendFailedException: 553 You are not authorized to send mail, ... how to pass the password to JFUtils to authenticate the from mail account?
|
|
|
|
|
whiletrue
|
Post subject: Remote run: sendEmail(...) |
Post rating: 0
|
Posted: Mon 16 Jun, 2014, 18:00
|
|
User rating: 0
Joined: Fri 17 May, 2013, 06:58 Posts: 76 Location: SwedenSweden
|
Hi,
How to use JFUtils.sendEmail(...) on Remote run? Should I specify the smtpServer string parameter as:
"<my_email>@gmail.com:<my_password>@smtp.gmail.com:465"
?
Thanks in advance.
Regards, Henrik
PS. It would be really nice if Dukascopy could provide a smtp server... =)
|
|
|
|
|
API Support
|
Post subject: Re: Remote run: sendEmail(...) |
Post rating: 0
|
Posted: Wed 18 Jun, 2014, 08:18
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
The functionality is not working on Remote at the moment, it will be fixed as soon as possible.
|
|
|
|
|
whiletrue
|
Post subject: Re: Remote run: sendEmail(...) |
Post rating: 0
|
Posted: Wed 18 Jun, 2014, 11:42
|
|
User rating: 0
Joined: Fri 17 May, 2013, 06:58 Posts: 76 Location: SwedenSweden
|
Ok, I see.
Please provide a complete example of how to use the JFUtils.sendEmail(...) on Remote run once it works again.
Thanks.
Regards, Henrik
|
|
|
|
|
API Support
|
Post subject: Re: Remote run: sendEmail(...) |
Post rating: 0
|
Posted: Fri 27 Jun, 2014, 08:36
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Fixed with JForex-API 2.9.12.
|
|
|
|
|
whiletrue
|
Post subject: Re: Remote run: sendEmail(...) |
Post rating: 0
|
Posted: Mon 30 Jun, 2014, 14:40
|
|
User rating: 0
Joined: Fri 17 May, 2013, 06:58 Posts: 76 Location: SwedenSweden
|
Great. But how to configure the smtp server when running remotely?
Thanks.
/Henrik
|
|
|
|
|
Moggy
|
Post subject: Re: Remote run: sendEmail(...) |
Post rating: 0
|
Posted: Fri 04 Jul, 2014, 02:17
|
|
User rating: 1
Joined: Tue 27 Aug, 2013, 17:39 Posts: 26 Location: China, Shanghai
|
API Support wrote: Fixed with JForex-API 2.9.12. 2.9.12 seems to be unavailable from the website now.
|
|
|
|
|
API Support
|
Post subject: Re: Remote run: sendEmail(...) |
Post rating: 0
|
Posted: Fri 11 Jul, 2014, 15:43
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Moggy wrote: 2.9.12 seems to be unavailable from the website now. It has not been released yet. whiletrue wrote: But how to configure the smtp server when running remotely? We are working on this, but it will not be available with 2.9.12.
|
|
|
|
|
whiletrue
|
Post subject: Re: Remote run: sendEmail(...) |
Post rating: 0
|
Posted: Tue 28 Oct, 2014, 12:34
|
|
User rating: 0
Joined: Fri 17 May, 2013, 06:58 Posts: 76 Location: SwedenSweden
|
Hi again,
Any progress regarding this matter? Please provide complete code example.
Thanks.
Kind Regards, Henrik
|
|
|
|
|
API Support
|
Post subject: Re: Remote run: sendEmail(...) |
Post rating: 0
|
Posted: Tue 28 Oct, 2014, 13:32
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
|
|
Pages: [
1, 2
»
]
|
|
|
|
|