Trying to set up the motion detection remotely using mydlink has always rendered the notorious java class exception for me. It simply doesn't work if you aren't on the same network as the cameras. However, I found out a solution that works for me. This solution demands that your ISP provides you with a public ip adress.
1) Using mydlink, go to Settings -> Advanced settings -> Setup -> Network Setup. Change HTTP Port to whatever you like, for example 81, and press Save settings.
2) Setup a proper mail account and SMTP under Setup -> Mail and press Test under Test e-mail account.
3) You should now have an email in your inbox. You now need to find out the sender ip adress, usually found in the header of your e-mail. How this is done depends on the e-mail client you're using. Google "how to find out sender ip adress thunderbird" or likewise. Note that the header usually contains a lot of different ip-adresses, so be sure that you look for the sender ip. It usually looks something like this:
Received: from WebCAM (host-90-233-205-x.mobileonline.your_isp.com [90.233.205.x]
In my setting I got 90.233.205.x as the sender ip.
4) Now enter the ip-adress in Chrome or your web browser of choice, adding the port number for your camera, in our example 90.233.205.x:81. You should get a login in window for your camera. If you don't, the probable cause is that your ISP doesn't provide public ip. Enter your credentials.
5) Go to Motion detection and watch the magic (hopefully).
If you have more than one camera, you repeat the procedure with another port number, for example 82.
Optional: if the above works, setup a dynamic dns service for your ip, you will reach your camera using mycamera.mydyndns.com:81