Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Send Mail Function
 Post subject: Send Mail Function Post rating: 0   New post Posted: Sun 12 Feb, 2017, 15:51 

User rating: 0
Joined: Mon 26 Sep, 2016, 11:57
Posts: 11
Location: United Arab EmiratesUnited Arab Emirates
Hi I`m trying to send mail Notification on remote server but I just can`t see it work !!

I found here the way but the code not working
https://www.dukascopy.com/wiki/en/development/strategy-api/practices/send-email
here is my code
package jforex;

import java.util.*;

import com.dukascopy.api.*;

public class Strategy implements IStrategy {
    private IEngine engine;
    private IConsole console;
    private IHistory history;
    private IContext context;
    private IIndicators indicators;
    private IUserInterface userInterface;
   
    public void onStart(IContext context) throws JFException {
        this.engine = context.getEngine();
        this.console = context.getConsole();
        this.history = context.getHistory();
        this.context = context;
        this.indicators = context.getIndicators();
        this.userInterface = context.getUserInterface();
       
       
        JFUtils utils = context.getUtils();

        try {
             Future<IEmailResponse> future = utils.sendMail("[email protected]", "subject", "text");
             console.getOut().println("Waiting on response");
             IEmailResponse response = future.get(30, TimeUnit.SECONDS);
             if (response.isError()) {
                 console.getErr().println(response);
             } else {
                 console.getOut().println("e-mail successfully sent!");
             }
         } catch (Exception e) {
             e.printStackTrace(console.getErr());
         }
       
       
       
    }

    public void onAccount(IAccount account) throws JFException {
    }

    public void onMessage(IMessage message) throws JFException {
    }

    public void onStop() throws JFException {
    }

    public void onTick(Instrument instrument, ITick tick) throws JFException {
    }
   
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
    }
}


14:50:11 ----------
14:50:11 TimeUnit cannot be resolved to a variable
14:50:11 ^^^^^^^^
14:50:11 IEmailResponse response = future.get(30, TimeUnit.SECONDS);
14:50:11 4. ERROR in C:\Users\GÜLENYILDIZ NET CAFE\AppData\Local\JForex\G_LENYILDIZ_NET_CAFE\jfxide\tmp\compile\Strategy.java (at line 29)
14:50:11 ----------
14:50:11 IEmailResponse cannot be resolved to a type
14:50:11 ^^^^^^^^^^^^^^
14:50:11 IEmailResponse response = future.get(30, TimeUnit.SECONDS);
14:50:11 3. ERROR in C:\Users\GÜLENYILDIZ NET CAFE\AppData\Local\JForex\G_LENYILDIZ_NET_CAFE\jfxide\tmp\compile\Strategy.java (at line 29)
14:50:11 ----------
14:50:11 IEmailResponse cannot be resolved to a type
14:50:11 ^^^^^^^^^^^^^^
14:50:11 Future<IEmailResponse> future = utils.sendMail("[email protected]", "subject", "text");
14:50:11 2. ERROR in C:\Users\GÜLENYILDIZ NET CAFE\AppData\Local\JForex\G_LENYILDIZ_NET_CAFE\jfxide\tmp\compile\Strategy.java (at line 27)
14:50:11 ----------
14:50:11 Future cannot be resolved to a type
14:50:11 ^^^^^^
14:50:11 Future<IEmailResponse> future = utils.sendMail("[email protected]", "subject", "text");
14:50:11 1. ERROR in C:\Users\GÜLENYILDIZ NET CAFE\AppData\Local\JForex\G_LENYILDIZ_NET_CAFE\jfxide\tmp\compile\Strategy.java (at line 27)
14:50:11 ----------


 
The Best Answer  Post subject: Re: Send Mail Function Post rating: 1   New post Posted: Mon 13 Feb, 2017, 09:18 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
See the attached file


Attachments:
Strategy.java [1.7 KiB]
Downloaded 128 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Send Mail Function Post rating: 0   New post Posted: Mon 13 Feb, 2017, 19:41 

User rating: 0
Joined: Mon 26 Sep, 2016, 11:57
Posts: 11
Location: United Arab EmiratesUnited Arab Emirates
That Helped , Thanks Alot
but can I put every Variable inside the messege in a new line
I tried This

Future<IEmailResponse> future = utils.sendMail("[email protected]", "subject", " " + Variable_1 + " /n " + Variable_2 + "/n " + Variable_3);


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com